dont understand windows event, please help

Just starting out? Need help? Post your questions and find answers here.
User avatar
Amon
User
User
Posts: 16
Joined: Wed Feb 18, 2004 1:24 am
Location: Shropshire, United Kingdom
Contact:

dont understand windows event, please help

Post 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.
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post 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)

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post 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
User avatar
Amon
User
User
Posts: 16
Joined: Wed Feb 18, 2004 1:24 am
Location: Shropshire, United Kingdom
Contact:

Post 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 :)
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post 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.. ;)

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Post Reply