Page 2 of 2

Posted: Fri Feb 16, 2007 3:42 pm
by zikitrake
Sparkie wrote:
zikitrake wrote:The last thing that I would like is to bother someone.
Not to worry zikitrake, I'm not bothered by your lib. :)

I thought since you created a lib for all this that you may have been using a method that was different and simpler than what I was using. My curiosity had me wondering. :wink:
:D Thank you!

Try this code to see what are the diferences, please

Code: Select all

Enumeration
  #ButtonGadget
  #StringGadget
  #CheckboxGadget
  #OptionGadget
EndEnumeration

; --> How many gadgets to tab
gadgetsToTab = 4

; --> Array of gadget tab stops
Global Dim tabStop(gadgetsToTab-1)

; --> Set tab stop order
tabStop(0) = #StringGadget
tabStop(1) = #OptionGadget
tabStop(2) = #ButtonGadget
tabStop(3) = #CheckboxGadget

; --> Procedure to change z-order (tab stops)
Procedure GadgetTabOrder()
  ; Get zero based array size
  tabCount = PeekL(@tabStop(0)-8)
  For gad = 0 To tabCount - 1
    If gad = 0
      ; First gadget is first tab stop
      pos = #HWND_TOP
    Else
      ; Remaining gadgets follow previous gadget
      pos = GadgetID(previousGad)
    EndIf
    previousGad = tabStop(gad)
    ; --> Make the z-order change
    SetWindowPos_(GadgetID(tabStop(gad)), pos, -1, -1, -1, -1, #SWP_NOMOVE | #SWP_NOSIZE | #SWP_SHOWWINDOW)
  Next gad
EndProcedure


Procedure WindowToSort(title.s)
  OpenWindow(0, 0, 0, 220, 130,title, #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  CreateGadgetList(WindowID(0))
  CheckBoxGadget(#CheckboxGadget, 70, 10, 200, 20, "Fouth Tab")
  ButtonGadget(#ButtonGadget, 10, 10, 50, 20, "Third Tab")
  StringGadget(#StringGadget, 10, 100, 200, 20, "First Tab")
  OptionGadget(#OptionGadget, 10, 40, 200, 20, "Second Tab")
EndProcedure

WindowToSort("Without reorder")
Repeat: event = WaitWindowEvent(): Until event = #PB_Event_CloseWindow

WindowToSort("Sparkie Original")
GadgetTabOrder()
Repeat: event = WaitWindowEvent(): Until event = #PB_Event_CloseWindow


WindowToSort("Sparkie Modified")
Ziki_GadgetTabOrder(WindowID(0))
Repeat: event = WaitWindowEvent(): Until event = #PB_Event_CloseWindow

Posted: Fri Feb 16, 2007 3:56 pm
by Sparkie
zikitrake wrote:Try this code to see what are the diferences, please
I would, but sorry to say your installer keeps wanting to install your lib into the wrong PB directory and I can't seem to change the destination directory to the correct one.

Posted: Fri Feb 16, 2007 3:58 pm
by zikitrake
Sparkie wrote:
zikitrake wrote:Try this code to see what are the diferences, please
I would, but sorry to say your installer keeps wanting to install your lib into the wrong PB directory and I can't seem to change the destination directory to the correct one.
Sorry, try this without installer: http://zikitrake.com/freeware/SortGadgetTabs

Posted: Fri Feb 16, 2007 6:29 pm
by Sparkie
Your lib works just fine zikitrake, nice job. :)

I now see what you were trying to accomplish. You want the tab order to more or less follow the GUI layout, whereas my code set the tab order to a custom order of your choice.

Posted: Fri Feb 16, 2007 8:24 pm
by zikitrake
Sparkie wrote:Your lib works just fine zikitrake, nice job. :)
Thank you!
Sparkie wrote:I now see what you were trying to accomplish. You want the tab order to more or less follow the GUI layout, whereas my code set the tab order to a custom order of your choice.
Yes! that is! I was made crazy creating/destroy/sorting all gadgets with PureVision (a great great tool)

... :oops: My bad English... :oops: