Restored from previous forum. Originally posted by geoff.
The help file says the function UseWindow() makes the specified
window the currently used window, however I'm rather unsure about
when to include this command.
I had window 1 with a popup menu and then opened window 2. Then I
closed window 2 and found that the menu on window 1 would not operate.
This problem was solved by putting a UseWindow(1) after the CloseWindow(2).
OK, but if I have several windows open, does this mean that Gadgets
and menus will only work on the window which last had a UseWindow()
command executed?
I can't put the UseWindow() command in the PureBasic event handler
because this only seems to run for the current window selected by
the last UseWindow() command. So what's the best way to
use the command UseWindow() when you have multiple windows?
Unsure about UseWindow()
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> what's the best way to use the command UseWindow() when you have multiple windows?
UseWindow() tells your app which window's event loop to use. So when
you open a new window, this new window's event loop is automatically
used. When you close this window, you use UseWindow() to specify
which window's event loop will now be used.
> what's the best way to use the command UseWindow() when you have multiple windows?
UseWindow() tells your app which window's event loop to use. So when
you open a new window, this new window's event loop is automatically
used. When you close this window, you use UseWindow() to specify
which window's event loop will now be used.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
IIRC, Gadget indexes are unique. So don't use the same gadget index for different gadgets, even if they are in different GadgetLists. I'm not so sure for menu items. Anyway, now that I'm writing, what about support for child windows in PB? SetParent_() doesn't do the job correctly.
Bye,
El_Choni
IIRC, Gadget indexes are unique. So don't use the same gadget index for different gadgets, even if they are in different GadgetLists. I'm not so sure for menu items. Anyway, now that I'm writing, what about support for child windows in PB? SetParent_() doesn't do the job correctly.
Bye,
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Manolo.
See the next example from Danilo:
Use the option SEARCH in the forum panel for searh solutions to you questions. Is very easy. And if this not exist ask to the forum.
Regards,
Manolo
See the next example from Danilo:
Code: Select all
#ID_MWindow =0 ; Mother
#ID_SWindow =1 ; Second
#ID_Button1 =10
#ID_Button2 =11
Procedure openwindow2()
hnd_SWindow=OpenWindow(#ID_SWindow,200,200,200,200,0,"Second Window")
If CreateGadgetList(hnd_SWindow)
ButtonGadget(#ID_Button2,50,50,50,20,"Exit")
EndIf
EndProcedure
hnd_MWindow=OpenWindow(#ID_MWindow,100,200,200,200,#PB_Window_SystemMenu,"Test")
If CreateGadgetList(hnd_MWindow)
ButtonGadget(#ID_Button1,50,50,50,20,"Open")
EndIf
Repeat
Event = WaitWindowEvent()
If Event=#PB_EventGadget
Select EventGadgetID()
Case #ID_Button1: openwindow2()
Case #ID_Button2: CloseWindow(#ID_SWindow)
EndSelect
EndIf
Until Event=#PB_Event_CloseWindow And EventWindowID() = #ID_MWindow
Regards,
Manolo
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by geoff.
Thank you all for your help.
Yes I see PB. The purebasic event handler works for the current selected window. That makes sense.
I also use a callback Windows message handler. This works all the time but of course the incoming Windows messages contain a window handle as there first parameter. It was the PureBasic event handler that caught me out.
Cheers,
Geoff
Thank you all for your help.
Yes I see PB. The purebasic event handler works for the current selected window. That makes sense.
I also use a callback Windows message handler. This works all the time but of course the incoming Windows messages contain a window handle as there first parameter. It was the PureBasic event handler that caught me out.
Cheers,
Geoff