Page 1 of 1

dont understand windows event, please help

Posted: Sun Feb 22, 2004 3:43 pm
by Amon
I'm not understanding this correctly.

If I used the visual designer to create 1 button labeled click me, then create the source, How would I code the little snippet to show the window with the button then code it so that when clicked it shows a message that say "you just clicked me".

I have no experience with window programming.

Posted: Sun Feb 22, 2004 4:07 pm
by LarsG
in the options in visual designer.. make sure you ticked off the inlude event loop.. then just export to editor.. the event for clicking the button will already be implemented (the debugger must be on for you to see)

Posted: Sun Feb 22, 2004 4:28 pm
by Henrik
As Lars said
And/or remark the line

; Debug "GadgetID: #Button_0"
and write : MessageRequester("MessageTitle","You just clicked me:",#PB_MessageRequester_Ok)
Like this

Code: Select all

IncludeFile "GeneratedIncludeFile.pb"

Open_Window_0()

Repeat  
  Event = WaitWindowEvent()

  If Event = #PB_EventGadget
    GadgetID = EventGadgetID()

    If GadgetID = #Button_0
      ;Debug "GadgetID: #Button_0"
      MessageRequester("MessageTitle","You just clicked me:",#PB_MessageRequester_Ok) 
    EndIf

  EndIf
Until Event = #PB_EventCloseWindow

End

Posted: Sun Feb 22, 2004 6:35 pm
by Amon
a 1000 thankyous. :D

Hi Larsg, how will i get on with PB ? I hope I can use it for all my app needs.

cya BC or here :)

Posted: Sun Feb 22, 2004 7:04 pm
by LarsG
Amon wrote:a 1000 thankyous. :D

Hi Larsg, how will i get on with PB ? I hope I can use it for all my app needs.

cya BC or here :)
Hi Amon..
Once you learn the basics, and the PureBasic syntax, I think you'll do just fine.. :)
And if you are stuck, there are nice people on this forum also.. ;)