Page 1 of 1

[4 beta 11] Splittergadget child size changes ++

Posted: Tue Apr 25, 2006 7:07 pm
by Trond
As #PB_Splitter_SecondFixed is passed one would expect the second gadget not to change width. As it is it is very clumsy to use an extra variable to preserve the width through the call to the splitter gadget.

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
ButtonGadget(1, 10, 10, 22, 25, "22")
ButtonGadget(2, 10, 10, 88, 25, "88")
SplitterGadget(3, 10, 10, 100, 25, 2, 1, #PB_Splitter_Vertical | #PB_Splitter_SecondFixed)


Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver

When the ListIconGadget is resized the icons' positions are not updated. First run the program as it is. Then uncomment the commented line and run the program again. Resize it to be very narrow (like the first program). The icons layout does not change, and there seems to be no way to make it change (I tried hiding it and showing it).

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu| #PB_Window_SizeGadget)
CreateGadgetList(WindowID(0))
ListIconGadget(0, 10, 10, 100, 364, "", 100)
ChangeListIconGadgetDisplay(0, 0)

dir.s = "c:\documents and settings\trond\mine dokumenter\mine bilder\"
If ExamineDirectory(0, dir, "*.bmp")
  While NextDirectoryEntry(0)
    Img = LoadImage(-1, dir + DirectoryEntryName(0))
    ResizeImage(Img, 32, 32, #PB_Image_Raw)
    AddGadgetItem(0, -1, DirectoryEntryName(0), ImageID(Img))
  Wend
EndIf


Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_SizeWindow
      ;ResizeGadget(0, 10, 10, WindowWidth(0)-20, WindowHeight(0)-20)
  EndSelect
ForEver

Re: [4 beta 11] Splittergadget child size changes ++

Posted: Tue Apr 25, 2006 7:45 pm
by Berikco
Trond wrote:As #PB_Splitter_SecondFixed is passed one would expect the second gadget not to change width. As it is it is very clumsy to use an extra variable to preserve the width through the call to the splitter gadget.

It does not mean the gadget will keep his width when the splitter is moved, it means if you use ResizeGadget() the second gadget will keep its width or height.
PB help wrote: #PB_Splitter_FirstFixed : When the splitter gadget is resized, the first gadget will keep its size
#PB_Splitter_SecondFixed : When the splitter gadget is resized, the second gadget will keep its size

Code: Select all

OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget)
CreateGadgetList(WindowID(0))
ButtonGadget(1, 10, 10, 22, 25, "22")
ButtonGadget(2, 10, 10, 88, 25, "88") 
SplitterGadget(3, 10, 10, 100, 25, 2, 1, #PB_Splitter_Vertical | #PB_Splitter_SecondFixed)


Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
  Case #PB_Event_SizeWindow
      ResizeGadget(3, 10, 10, WindowWidth(0)-20, WindowHeight(0)-20) 
  EndSelect
ForEver

Posted: Wed Apr 26, 2006 12:59 pm
by Trond
Maybe this should be moved to feature requests.