I've noticed that all the events available for each gadget aren't necessarily documented with the documentation for that gadget ...
Is there a documentation or constants file somewhere that details ALL the events available for all the PureBasic gadgets?
Thanks!
Events for all gadgets ?
Events for all gadgets
I'd like to know what all the available #PB_... events are for each gadget. For example, in the documentation there are no events listed for the StringGadget. Does that mean the StringGadget doesn't generate any events?
Where can I find all the events supported by each gadget?
If not in the doc then maybe some constants file somewhere?
Thanks!
Where can I find all the events supported by each gadget?
If not in the doc then maybe some constants file somewhere?
Thanks!
Valid Events for each gadget, some have none listed in doc ?
For example:
- So how can I tell they're typing in text in a string gadget if I want to trap every keystroke?
- With a combobox gadget, how can I tell they've made a selection and react to that event?
- With an option gadget, how can I react to a selection being made? Etc.
Maybe I'm missing something here?
- So how can I tell they're typing in text in a string gadget if I want to trap every keystroke?
- With a combobox gadget, how can I tell they've made a selection and react to that event?
- With an option gadget, how can I react to a selection being made? Etc.
Maybe I'm missing something here?
Using thise:So how can I tell they're typing in text in a string gadget if I want to trap every keystroke?
Code: Select all
Procedure KeyboardProc(nCode,wParam,temp)
MessageRequester("KeyPress","VirtCode "+Str(wParam),0)
ProcedureReturn 0
EndProcedure
OpenWindow(0,0,0,400,300,#PB_Window_Systemmenu| #PB_Window_MinimizeGadget| #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered |#PB_Window_sizegadget ,"World View")
If CreateGadgetList(WindowID(0))
StringGadget(0,40,40,100,30,"")
EndIf
;declare event's on user down key or user up key.
SetWindowsHook_(#WH_KEYBOARD,@KeyboardProc())
Repeat
Event=WindowEvent()
Until Event=#PB_Event_CloseWindowEtc.
Re: Valid Events for each gadget, some have none listed in d
> how can I tell they're typing in text in a string gadget?
> With a combobox gadget, how can I tell they've made a selection?
> With an option gadget, how can I react to a selection being made?
Best way to show all the above is with a practical example:
> Maybe I'm missing something here?
Well, it's all in the manual... but as you said, not always where might be
the most logical places. Still, if you browse all sections of the manual,
you'll usually find what you want.
> With a combobox gadget, how can I tell they've made a selection?
> With an option gadget, how can I react to a selection being made?
Best way to show all the above is with a practical example:
Code: Select all
If OpenWindow(1,0,0,400,100,#PB_Window_ScreenCentered,"test")
If CreateGadgetList(WindowID())
StringGadget(1,10,10,50,20,"")
ComboBoxGadget(2,100,10,50,100)
For r=1 To 5 : AddGadgetItem(2,-1,Str(r)) : Next
SetGadgetText(2,"1")
OptionGadget(3,200,10,50,20,"one") : SetGadgetState(3,#TRUE)
OptionGadget(4,250,10,50,20,"two")
OptionGadget(5,300,10,50,20,"three")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget ; A gadget has been clicked!
Select EventGadgetID() ; Which one?
Case 1 ; StringGadget clicked or typed.
new$=GetGadgetText(1) ; Get its contents.
If new$<>old$ ; Its contents have changed!
old$=new$ ; Remember the new contents.
Debug "StringGadget has been typed"
EndIf
Case 2 : Debug GetGadgetText(2) ; ComboBoxGadget clicked.
Case 3 : Debug "Option1 Clicked"
Case 4 : Debug "Option2 Clicked"
Case 5 : Debug "Option3 Clicked"
EndSelect
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
EndIf
Well, it's all in the manual... but as you said, not always where might be
the most logical places. Still, if you browse all sections of the manual,
you'll usually find what you want.
Last edited by PB on Wed Mar 31, 2004 7:00 am, edited 1 time in total.
Thanks
Thanks guys!
Thanks for taking the time to make the excellent example for me PB! I appreciate it, especially since it is pure PB code and no WindowAPI references.
I am only interested in developing cross-platform apps.
Thanks for taking the time to make the excellent example for me PB! I appreciate it, especially since it is pure PB code and no WindowAPI references.


