Announcement

Collapse
No announcement yet.

Winbutton get state of it in MagicCode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Winbutton get state of it in MagicCode

    Hello everyone,
    I have a problem. I have in a small MagicCode part one (if) function. I would know how I can get the value of the state of the button. I tried to ask with If(Winbutton0 == 1) but that doesen't work. Also it has to be only the state 1 if it was pressed and not if it ist pressed right now. How I can solve that without writhing much code.
    Thanks

  • #2
    Hi Simon,

    Welcome to the forum!

    You could get use the command Img_GetWord(). This command should get the current frame of the button.
    Code:
    e.g.
    img_GetWord(hndl, iWinbutton0, IMAGE_INDEX);
    Another option is by introducing a MagicEvent in the WinButton. If you pass an event to the button, it will return the current state of the widget. To do this, create a MagicEvent, and link the OnChanged Event of the button to the MagicEvent. Try to add a print function to simulate and test. Changing the Momentary (Properties) of the button should get you different results.

    Should you need further assistance, please don't hesitate to ask.

    Best Regards,
    Kevin

    Comment

    Working...
    X