Page 1 of 1

Posted: Sat Oct 12, 2002 2:22 pm
by BackupUser
Restored from previous forum. Originally posted by blueb.

Suppose I have 20 gadgets on my form.

How can I re-arrange the order so that
when I press the 'Tab' key, the focus
shifts to the gadget I desire?

Regards,
--blueb

Posted: Sat Oct 12, 2002 3:14 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> How can I re-arrange the order so that when I press the 'Tab' key,
> the focus shifts to the gadget I desire?

Pressing TAB will go to the next gadget in the tab list, and the list
is sorted according to the order in which the gadgets are created.


PB - Registered PureBasic Coder

Posted: Sat Oct 12, 2002 5:11 pm
by BackupUser
Restored from previous forum. Originally posted by blueb.

Hi Paul,
You mis-understood.

I know that's what happens. I want to know if
there is a command I'm unaware of that will
*change* this order, much like you can in most
languages. (Windows calls this 'Z-Order')

You could have tens of controls on form, and it
can be cumbersome to go back and change this
after you're deep into a project, especially if
Procedures are involved.

I might have to look into the API SendMessage
command.

--blueb

Posted: Sat Oct 12, 2002 9:25 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

To stop an individual gadget receiving the focus, you can do this:

Code: Select all

If OpenWindow(0,100,150,400,200,#PB_Window_SystemMenu,"Test")
  CreateGadgetList(WindowID())
  ButtonGadget(1,20,20,180,20,"Button 1")
  ButtonGadget(2,20,60,180,20,"Button 2")
  ButtonGadget(3,20,90,180,20,"Button 3")
  ActivateGadget(1)
  Repeat
    ev=WaitWindowEvent()
    ; Next line stops button 2 from ever receiving the focus.
    If GetFocus_()=GadgetID(2) : ActivateGadget(3) : EndIf
  Until ev=#PB_EventCloseWindow
EndIf

PB - Registered PureBasic Coder

Posted: Sat Oct 12, 2002 10:30 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

SetWindowPos_() can be used to change the Z order of the gadgets.

Fred - AlphaSND