About Store Forum Documentation Contact



Post Reply 
Mouse Button Released Issue
Author Message
AndrewBGS Offline
Member

Post: #1
Mouse Button Released Issue
I'm starting to believe that there's something wrong with the Ms.br(x) function.
I wouldn't suspect this unless I had met the problem in two places:

1) Inventory update
I have a button on the inventory. Basically it should increment a number. The button has mode set to DEFAULT, which the comments claim means that the button is only activated upon button release.
When click it, I don't even release it and the number is incremented like 5-6 times. Emphasise on "I don't release it".
Here's the code regarding it:

Button next; ....
next.enabled(true); next.mode=BUTTON_DEFAULT;
....
if(next()) pannel++;

2) Another inventory update
Trying to achieve drag&drop equipping, I added a OR Ms.br(0) in the update function that handles placing the temporary item in the gear GUI.
Drag and drop still does not work (I have the temp item attached, i release the mouse on the correct slot, nothing happens). The same thing work correctly with the Ms.bp(0) by default, so it's not a code issue. Releasing the mouse button just doesn't get me into that if. Looks like this:

if(Ms.bp(0) || Ms.br(0))


Any idea what could be wrong? I'm kinda lost here, it should be something very simple.
05-06-2013 05:56 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Mouse Button Released Issue
Hi

1) The Button operator () detects if button is visually pushed. What you want is to use Button.func to set function which will be called upon proper button click.
05-07-2013 11:37 AM
Find all posts by this user Quote this message in a reply
AndrewBGS Offline
Member

Post: #3
RE: Mouse Button Released Issue
Well, I just followed the tutorial and tried doing pretty much the same thing; increment a number when the buttons is... well, released I guess. I'll see if i can work around that.

But what about the other part? Trying to achieve drag & drop in the inventory?
Dropping on release doesn't seem to work either, and it's because it's not entering the if on Ms.br(0). I checked.
05-07-2013 11:56 AM
Find all posts by this user Quote this message in a reply
Post Reply