Page 1 of 1

SplitterGadget co-ordinate problems.

Posted: Fri Jun 13, 2003 3:49 am
by Fangbeast
Okay, I admit it!! I don't understand the splitter gadget co-ordinate system, they don't make sense to me. I also downloaded the latest gadget updates because I was having the refresh problem destroying windows under XP pro. With the code below, I get the gadgets laid out on screen how I want them (I got something right!!!) but the vertical splitter gadget seems to be taking over the screen when you hover the mouse anywhere to the right. The horizontal splitter is in the right position visibly but no working (sigh)

Code: Select all

#TV_FIRST             = $1100
#TVM_SETBKCOLOR       = #TV_FIRST + 29
#TVM_SETTEXTCOLOR     = #TV_FIRST + 30

#WindowIndex          = 0
#GadgetIndex          = 0
#ImageIndex           = 0
#StatusBarIndex       = 0
#MenuBarIndex         = 0

#Form                 = #WindowIndex    : #WindowIndex    = #WindowIndex    + 1

#MenuBar              = #MenuBarIndex   : #MenuBarIndex   = #MenuBarIndex   + 1

#Tree                 = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1
#ListIcon             = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1
#Web                  = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1
#ComboBox8            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1
#ComboBox9            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1
#String               = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1

#Splitter1            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1
#Splitter2            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1

#StatusBar            = #StatusBarIndex : #StatusBarIndex = #StatusBarIndex + 1
#StatusBar_Field1     = 0
#StatusBar_Field2     = 1
#StatusBar_Field3     = 2
#StatusBar_Field4     = 3

Procedure.l Form()
  If OpenWindow(#Form,175,0,640,480,#PB_Window_SystemMenu|#PB_Window_Invisible,"Work Form1")
    CreateMenu(#MenuBar,WindowID(#Form))
      MenuTitle("Files")
    If CreateGadgetList(WindowID())
      TreeGadget(#Tree,#Null,#Null,#Null,#Null,#PB_Tree_AlwaysShowSelection)
        SendMessage_(GadgetID(#Tree),#TVM_SETBKCOLOR,0,16744448)
        AddGadgetItem(#Tree, -1, "Empty Tree")
      ListIconGadget(#ListIcon,#Null,#Null,#Null,#Null,"ListIcon",100,#PB_ListIcon_MultiSelect|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
        SendMessage_(GadgetID(#ListIcon),#LVM_SETBKCOLOR,0,16744448)
        SendMessage_(GadgetID(#ListIcon4),#LVM_SETTEXTBKCOLOR,0,16744448)
        AddGadgetItem(#ListIcon, -1, "List Icon Gadget")
      WebGadget(#Web,#Null,#Null,#Null,#Null,"Web5")
      ComboBoxGadget(#ComboBox8,0,420,120,200)
      ComboBoxGadget(#ComboBox9,125,420,120,200)
      StringGadget(#String,245,420,395,20,"")
      
      SplitterGadget(#Splitter1, 0,0,640,415, #Tree,#ListIcon,#PB_Splitter_Vertical|#PB_Splitter_Separator)
      SetGadgetState(#Splitter1, 120)

      SplitterGadget(#Splitter2, 126,0,514,414, #ListIcon,#Web, #PB_Splitter_Separator)
      SetGadgetState(#Splitter2, 120)

      CreateStatusBar(#StatusBar,WindowID(#Form))
        AddStatusBarField(100)
        AddStatusBarField(100)
        AddStatusBarField(100)
        AddStatusBarField(100)
      HideWindow(#Form,0)
      ProcedureReturn WindowID()
    EndIf
  EndIf
EndProcedure

If Form()
  Repeat
    EventID = WaitWindowEvent()
  Until EventID = #PB_Event_CloseWindow And EventWindowID() = #Form
  CloseWindow(#Form)
EndIf


Posted: Fri Jun 13, 2003 9:27 am
by Fred
I agree, splitters aren't as easy to understand than other gadgets, but once you get it, it seems obvious. First you have to define your layout, so, how will react your app. A splitter can only have 2 childs, so you have to create severals if you want several splitters in splitters. In your case,
the ListIcon and the Web are the childs of other splitter (Tree + Splitter which contains the 2 gadgets). It results to the following examples which should be ok:

Code: Select all

#TV_FIRST             = $1100 
#TVM_SETBKCOLOR       = #TV_FIRST + 29 
#TVM_SETTEXTCOLOR     = #TV_FIRST + 30 

#WindowIndex          = 0 
#GadgetIndex          = 0 
#ImageIndex           = 0 
#StatusBarIndex       = 0 
#MenuBarIndex         = 0 

#Form                 = #WindowIndex    : #WindowIndex    = #WindowIndex    + 1 

#MenuBar              = #MenuBarIndex   : #MenuBarIndex   = #MenuBarIndex   + 1 

#Tree                 = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 
#ListIcon             = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 
#Web                  = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 
#ComboBox8            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 
#ComboBox9            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 
#String               = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 

#Splitter1            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 
#Splitter2            = #GadgetIndex    : #GadgetIndex    = #GadgetIndex    + 1 

#StatusBar            = #StatusBarIndex : #StatusBarIndex = #StatusBarIndex + 1 
#StatusBar_Field1     = 0 
#StatusBar_Field2     = 1 
#StatusBar_Field3     = 2 
#StatusBar_Field4     = 3 

Procedure.l Form() 
  If OpenWindow(#Form,175,0,640,480,#PB_Window_SystemMenu|#PB_Window_Invisible,"Work Form1") 
    CreateMenu(#MenuBar,WindowID(#Form)) 
      MenuTitle("Files") 
    If CreateGadgetList(WindowID()) 
      TreeGadget(#Tree,#Null,#Null,#Null,#Null,#PB_Tree_AlwaysShowSelection) 
        SendMessage_(GadgetID(#Tree),#TVM_SETBKCOLOR,0,16744448) 
        AddGadgetItem(#Tree, -1, "Empty Tree") 
      ListIconGadget(#ListIcon,#Null,#Null,#Null,#Null,"ListIcon",100,#PB_ListIcon_MultiSelect|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection) 
        SendMessage_(GadgetID(#ListIcon),#LVM_SETBKCOLOR,0,16744448) 
        SendMessage_(GadgetID(#ListIcon),#LVM_SETTEXTBKCOLOR,0,16744448) 
        AddGadgetItem(#ListIcon, -1, "List Icon Gadget") 
      WebGadget(#Web,#Null,#Null,#Null,#Null,"Web5") 
      ComboBoxGadget(#ComboBox8,0,420,120,200) 
      ComboBoxGadget(#ComboBox9,125,420,120,200) 
      StringGadget(#String,245,420,395,20,"") 
      
      SplitterGadget(#Splitter2, 126,0,514,414, #ListIcon,#Web, #PB_Splitter_Separator) 
      SetGadgetState(#Splitter2, 120) 
      
      SplitterGadget(#Splitter1, 0,0,640,415, #Tree, #Splitter2, #PB_Splitter_Vertical|#PB_Splitter_Separator) 
      SetGadgetState(#Splitter1, 120) 

      CreateStatusBar(#StatusBar,WindowID(#Form)) 
        AddStatusBarField(100) 
        AddStatusBarField(100) 
        AddStatusBarField(100) 
        AddStatusBarField(100) 
      HideWindow(#Form,0) 
      ProcedureReturn WindowID() 
    EndIf 
  EndIf 
EndProcedure 

If Form() 
  Repeat 
    EventID = WaitWindowEvent() 
  Until EventID = #PB_Event_CloseWindow And EventWindowID() = #Form 
  CloseWindow(#Form) 
EndIf 

Thanks Master Fred

Posted: Fri Jun 13, 2003 9:45 am
by Fangbeast
I know it works and I can see that but my head still hurts from figuring out why. Oh well, I think even I can follow this :):)

refresh problem ..

Posted: Fri Jun 13, 2003 10:37 am
by Fangbeast
You nice clean example works just great. But If I use your example with a more complicated form like below, the horizontal bar doesn't appear (Except when I drag something) and the treegadget is grey (until I drag something) so something is eating the gadget draw for some reason.

Code: Select all

Procedure.l Window_serialdebase()

  If OpenWindow(#Window_serialdebase, 245, 1, 700, 466, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_Invisible | #PB_Window_ScreenCentered, #ProgramVersion)
    If nan
      AnimateWindow1(WindowID(), 700, #AW_BLEND)
    EndIf
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Up,                   #ShortCut_serialdebase_uparrow)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Down,                 #ShortCut_serialdebase_downarrow)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Return,               #ShortCut_serialdebase_enterkey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_A, #ShortCut_serialdebase_altakey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_E, #ShortCut_serialdebase_altekey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_D, #ShortCut_serialdebase_altdkey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_H, #ShortCut_serialdebase_althkey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_Q, #ShortCut_serialdebase_altqkey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_U, #ShortCut_serialdebase_altukey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_X, #ShortCut_serialdebase_altxkey)
    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_F1,                   #ShortCut_serialdebase_f1key)      ; Help wanted
    makemenu()
    If CreateGadgetList(WindowID())
      TreeGadget(#Gadget_serialdebase_alphabetic,5,5,100,396,#PB_Tree_AlwaysShowSelection|#PB_Tree_NoLines)
      tip(GadgetID(#Gadget_serialdebase_alphabetic), "Click on one of these sub categories to show only the serial numbers in that category in the main window")
        OpenTreeGadgetNode(#Gadget_serialdebase_alphabetic)
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Deleted", CatchImage(#Image_serialdebase_deleted, ?deleted))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Bad Serials", CatchImage(#Image_serialdebase_bad, ?baditem))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Amstrad", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Apple", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "BeOS", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "WinCe", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Linux", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Newton", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Palmpilot", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Windows", CatchImage(#Image_serialdebase_category, ?category))
          AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Sega", CatchImage(#Image_serialdebase_category, ?category))
        CloseTreeGadgetNode(#Gadget_serialdebase_alphabetic)
      ListIconGadget(#Gadget_serialdebase_minordetail,108,5,587,200,"Software",380,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
      tip(GadgetID(#Gadget_serialdebase_minordetail), "Click on any of these items to show full details for it in the web display box below")
        AddGadgetColumn(#Gadget_serialdebase_minordetail,1,"Version",100)
        AddGadgetColumn(#Gadget_serialdebase_minordetail,2,"Platform",100)
        AddGadgetColumn(#Gadget_serialdebase_minordetail,3,"Record",0)
      WebGadget(#Gadget_serialdebase_alldetails,108,210,587,190,"Foo")
      TextGadget(#Gadget_serialdebase_search,5,404,100,20,"Search for item",#PB_Text_Center|#PB_Text_Border)
      ComboBoxGadget(#Gadget_serialdebase_searchmode,108,404,124,200)
      tip(GadgetID(#Gadget_serialdebase_searchmode), "Select the type of SQL search that you want to perform on the search data with the search string")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "View All")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Equal To")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Greater Than")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Less Than")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Greater Than/Equal To")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Less Than/Equal To")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Not Equal")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Sounds Like")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Starts With")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Ends With")
      ComboBoxGadget(#Gadget_serialdebase_collumn,235,404,124,200)
      tip(GadgetID(#Gadget_serialdebase_collumn),"Select the collumn of information in the database that you want to perform this search on")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "id")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "product")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "company")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "platform")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "version")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "url")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "information")
      StringGadget(#Gadget_serialdebase_searchbox,360,404,335,20,"")
      tip(GadgetID(#Gadget_serialdebase_searchbox),"Type in here the string of characters that you want to search for and press Enter/Return to start the search")
      ;---------------------------------------------------------------------------------------------------------------------
      SplitterGadget(#Splitter2, 108,0,587,400, #Gadget_serialdebase_minordetail,#Gadget_serialdebase_alldetails, #PB_Splitter_Separator) 
      SetGadgetState(#Splitter2, 108)
      SplitterGadget(#Splitter1, 0,0,700,400, #Gadget_serialdebase_alphabetic, #Splitter2, #PB_Splitter_Vertical|#PB_Splitter_Separator) 
      SetGadgetState(#Splitter1, 104) 
      ;---------------------------------------------------------------------------------------------------------------------      
      CreateStatusBar(#StatusBar_serialdebase, WindowID(#Window_serialdebase))
        AddStatusBarField(580)
        StatusBarIcon(#StatusBar_serialdebase, 0, CatchImage(#Image_serialdebase_sqlcommand, ?sqlcommand))
        AddStatusBarField(116)
        StatusBarIcon(#StatusBar_serialdebase, 1, CatchImage(#Image_serialdebase_records, ?records))
      HideWindow(#Window_serialdebase, 0)
      ActivateWindow()
      ProcedureReturn WindowID()
    EndIf
  EndIf
EndProcedure

Posted: Fri Jun 13, 2003 11:00 am
by Fred
I can't compile this code.

I know Fred :)

Posted: Fri Jun 13, 2003 11:33 am
by Fangbeast
Sorry, full program is 3,000 lines. I just thought someone might have an idea as I read somewhere about refresh problems with Splitter.

Can send it all to you if you want

Posted: Fri Jun 13, 2003 6:56 pm
by fsw
Fangles I changed your last code to:

Code: Select all

#Window_serialdebase = 0
#ProgramVersion = "0.01"
#Gadget_serialdebase_alphabetic = 1
#Gadget_serialdebase_minordetail = 2
#Gadget_serialdebase_alldetails = 3
#Gadget_serialdebase_search = 4
#Gadget_serialdebase_searchmode =5
#Gadget_serialdebase_collumn = 6
#Gadget_serialdebase_searchbox = 7
#Splitter1 = 8
#Splitter2 = 9
#StatusBar_serialdebase = 10


Procedure.l Window_serialdebase()

  If OpenWindow(#Window_serialdebase, 245, 1, 700, 466, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_Invisible | #PB_Window_ScreenCentered, #ProgramVersion)
    If nan
 ;     AnimateWindow1(WindowID(), 700, #AW_BLEND)
    EndIf
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Up,                   #ShortCut_serialdebase_uparrow)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Down,                 #ShortCut_serialdebase_downarrow)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Return,               #ShortCut_serialdebase_enterkey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_A, #ShortCut_serialdebase_altakey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_E, #ShortCut_serialdebase_altekey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_D, #ShortCut_serialdebase_altdkey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_H, #ShortCut_serialdebase_althkey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_Q, #ShortCut_serialdebase_altqkey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_U, #ShortCut_serialdebase_altukey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_Alt | #PB_Shortcut_X, #ShortCut_serialdebase_altxkey)
;    AddKeyboardShortcut(#Window_serialdebase, #PB_Shortcut_F1,                   #ShortCut_serialdebase_f1key)      ; Help wanted
;    makemenu()
    If CreateGadgetList(WindowID())
      TreeGadget(#Gadget_serialdebase_alphabetic,5,5,100,396,#PB_Tree_AlwaysShowSelection|#PB_Tree_NoLines)
;      tip(GadgetID(#Gadget_serialdebase_alphabetic), "Click on one of these sub categories to show only the serial numbers in that category in the main window")
        OpenTreeGadgetNode(#Gadget_serialdebase_alphabetic)
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Deleted", CatchImage(#Image_serialdebase_deleted, ?deleted))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Bad Serials", CatchImage(#Image_serialdebase_bad, ?baditem))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Amstrad", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Apple", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "BeOS", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "WinCe", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Linux", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Newton", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Palmpilot", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Windows", CatchImage(#Image_serialdebase_category, ?category))
      ;    AddGadgetItem(#Gadget_serialdebase_alphabetic, -1, "Sega", CatchImage(#Image_serialdebase_category, ?category))
        CloseTreeGadgetNode(#Gadget_serialdebase_alphabetic)
      ListIconGadget(#Gadget_serialdebase_minordetail,108,5,587,200,"Software",380,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
;      tip(GadgetID(#Gadget_serialdebase_minordetail), "Click on any of these items to show full details for it in the web display box below")
        AddGadgetColumn(#Gadget_serialdebase_minordetail,1,"Version",100)
        AddGadgetColumn(#Gadget_serialdebase_minordetail,2,"Platform",100)
        AddGadgetColumn(#Gadget_serialdebase_minordetail,3,"Record",0)
      WebGadget(#Gadget_serialdebase_alldetails,108,210,587,190,"Foo")
      TextGadget(#Gadget_serialdebase_search,5,404,100,20,"Search for item",#PB_Text_Center|#PB_Text_Border)
      ComboBoxGadget(#Gadget_serialdebase_searchmode,108,404,124,200)
;      tip(GadgetID(#Gadget_serialdebase_searchmode), "Select the type of SQL search that you want to perform on the search data with the search string")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "View All")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Equal To")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Greater Than")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Less Than")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Greater Than/Equal To")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Less Than/Equal To")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Not Equal")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Sounds Like")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Starts With")
        AddGadgetItem(#Gadget_serialdebase_searchmode, -1, "Ends With")
      ComboBoxGadget(#Gadget_serialdebase_collumn,235,404,124,200)
;      tip(GadgetID(#Gadget_serialdebase_collumn),"Select the collumn of information in the database that you want to perform this search on")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "id")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "product")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "company")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "platform")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "version")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "url")
        AddGadgetItem(#Gadget_serialdebase_collumn,-1, "information")
      StringGadget(#Gadget_serialdebase_searchbox,360,404,335,20,"")
;      tip(GadgetID(#Gadget_serialdebase_searchbox),"Type in here the string of characters that you want to search for and press Enter/Return to start the search")
      ;---------------------------------------------------------------------------------------------------------------------
      SplitterGadget(#Splitter2, 108,0,587,400, #Gadget_serialdebase_minordetail,#Gadget_serialdebase_alldetails, #PB_Splitter_Separator)
      SetGadgetState(#Splitter2, 108)
      SplitterGadget(#Splitter1, 0,0,700,400, #Gadget_serialdebase_alphabetic, #Splitter2, #PB_Splitter_Vertical|#PB_Splitter_Separator)
      SetGadgetState(#Splitter1, 104)
      ;---------------------------------------------------------------------------------------------------------------------     
      CreateStatusBar(#StatusBar_serialdebase, WindowID(#Window_serialdebase))
        AddStatusBarField(580)
;        StatusBarIcon(#StatusBar_serialdebase, 0, CatchImage(#Image_serialdebase_sqlcommand, ?sqlcommand))
        AddStatusBarField(116)
;        StatusBarIcon(#StatusBar_serialdebase, 1, CatchImage(#Image_serialdebase_records, ?records))
      HideWindow(#Window_serialdebase, 0)
      ActivateWindow()
      ProcedureReturn WindowID()
    EndIf
  EndIf
EndProcedure 

Window_serialdebase()
Repeat 
Until WaitWindowEvent() = #PB_Event_CloseWindow
and the treegadget was not grey and the horizontal splitter comes up instantly (or what do you meant as horizontal bar? the statusbar? no problem there too...under Win2ksp3)

I assume I didn't help much, sorry...
Franco

Yes, youa re right.

Posted: Sat Jun 14, 2003 5:07 am
by Fangbeast
Essentially, you removed items that might be taking longer to draw than others...Perhaps I have to figure out if I need to flush events after each gadget.

With your example commenting out writing to the gadgets, commenting out the animation etc, the treegadget does come up properly.

Once i re-enable those items, the gadgets comes up grey and the horizontal splitter doesn't appear until you drag something

I might stick half a dozen event flushers in there to see if it makes a difference.

Thanks for trying

Problem solved!!

Posted: Sat Jun 14, 2003 8:12 am
by Fangbeast
It appears to be a problem with the gadget events form splitter not finishing fast enough (maybe) or eating the refresh/redraw from other gadgets.

if I put the code below (may as well call it FlushEvents()) IMMEDIATELY AFTER the splitter gadgets, all gadgets draw properly and show up.

Code: Select all

      While WindowEvent():Wend
I was experimenting with flushing various gadgets the same way during the windows creation and that was the only one that worked:)

Funnily enough, if the gadgets are blank (That is, having no items drawn in them) this problem never occurs. It's only populated gadgets (trees, lists, listicons etc) that have the blanking out.

Resizing the splitter in a callback correctly?

Posted: Sun Jun 15, 2003 10:26 am
by Fangbeast
Referring to my window above, this is the callback that resizes my form. My comboboxes, stringgadgets and splitter1 all resize properly.

Splitter 2 doesn't. Can anyone tell me what the correct resize parameters are for splitter 2 to resize properly with the form? (grovel grovel)

Code: Select all

Procedure ResizeCallback(WindowID, Message, wParam, lParam)

  Result = #PB_ProcessPureBasicEvents 
  
  If WindowID = WindowID(#Window_serialdebase)
    Select Message
      Case #WM_SIZE                                                     ; Form's size has changed.
        UseWindow(#Window_serialdebase)                                 ; Use the right window
        winwidth.l  = WindowWidth()                                     ; Get the new width of the window
        winheight.l = WindowHeight()                                    ; Get the new height of the window
        widthchange  = winwidth  - OriginalWidth                        ; Get the width difference
        heightchange = winheight - OriginalHeight                       ; Get the height difference 108,0,587,400
        ;-----------------------------------------------------------------------------------------------------------------
        ResizeGadget(#Splitter2,                       108,   0 + heightchange, 587 + widthchange, 400 + heightchange); 400 + heightchange) 
        ResizeGadget(#Splitter1,                        -1,                 -1,                -1, 400 + heightchange)

        ResizeGadget(#Gadget_serialdebase_search,        5, 404 + heightchange,               100,  20)
        ResizeGadget(#Gadget_serialdebase_searchmode,  108, 404 + heightchange,               124, 200)
        ResizeGadget(#Gadget_serialdebase_collumn,     235, 404 + heightchange,               124, 200)
        ResizeGadget(#Gadget_serialdebase_searchbox,   360, 404 + heightchange, 335 + widthchange,  20)

        UpdateStatusBar(#StatusBar_serialdebase)
        NewStatusBarWidth = WindowWidth()                               ; Get new width
        SendMessage_(hStatusBar, #SB_GETPARTS, 2, @StatusBarFields())   ; 4 is the number of Fields in the StatusBar
        For i = 0 To 1                                                  ; 3 is number of Fields-1, because Array goes from 0 to 3
          StatusBarFields(i) = StatusBarFields(i) + (NewStatusBarWidth - OldStatusBarWidth)
        Next i
        SendMessage_(hStatusBar, #SB_SETPARTS, 2, @StatusBarFields())      
        OldStatusBarWidth = NewStatusBarWidth                           ; New Width will be old next time
        RedrawWindow_(WindowID(#Window_serialdebase), 0, 0, #RDW_INVALIDATE)
    EndSelect 
  EndIf 
  
  ProcedureReturn Result 
  
EndProcedure 


anyone?

Posted: Mon Jun 16, 2003 12:15 pm
by Fangbeast
Anyone?

Posted: Mon Jun 16, 2003 3:38 pm
by freak
Hmm, I must have overlooked this... but here we go....

If you resize a splitter, don't resize the stuff inside, as this get's
automatically resized with the splitter. Also, I don't know, what it does to
the Splitter, if you resize a gadget inside it.

In your case, this means, that #Splitter2 doesn't need to be resized, as
it get's automatically resized, if the #Splitter1 is resized.

So what I chaged, is I removed the ResizeGadget for #Splitter2, and
changed the one for #Splitter1 a bit:

Code: Select all

ResizeGadget(#Splitter1,                        -1,                 -1,                700+ widthchange, 400 + heightchange) 

(I changed -1 to 700+widthchange for the with parameter, so it fits the
new window width.)

I also added the following right after the OpenWindow command:

Code: Select all

  Global OriginalWidth.l, OriginalHeight.l
  OriginalWidth = WindowWidth()
  OriginalHeight = WindowHeight()
But I assume, you allready have that somewhere in your code (or not? :wink: )

Anyway, your form resizes correctly here now. 8)

Timo

Damn, I was so close and didn't know it:):)

Posted: Tue Jun 17, 2003 2:34 am
by Fangbeast
freak wrote:Hmm, I must have overlooked this... but here we go....

If you resize a splitter, don't resize the stuff inside, as this get's
automatically resized with the splitter. Also, I don't know, what it does to
the Splitter, if you resize a gadget inside it.

In your case, this means, that #Splitter2 doesn't need to be resized, as
it get's automatically resized, if the #Splitter1 is resized.

So what I chaged, is I removed the ResizeGadget for #Splitter2, and
But I assume, you allready have that somewhere in your code (or not? :wink: )

Anyway, your form resizes correctly here now. 8)

Timo
Yes, I did have the global variables, I was just thinking backwards!! Strangely enough, this also fixed the refresh problem witht he gadgets when I load and query data. THat's a bonus.

Now I can figure out how to make some decent looking forms because mine are just plain boring :):)

Thanks heaps Timo :wink: