Native ResizeGadgetsWindow_0 procedure from Form Designer problem

Post bugs related to the IDE here
tatanas
Enthusiast
Enthusiast
Posts: 198
Joined: Wed Nov 06, 2019 10:28 am
Location: France

Native ResizeGadgetsWindow_0 procedure from Form Designer problem

Post by tatanas »

Hi,

I've got problem with gadgets auto resizing inside a Panel with the native ResizeGadgetsWindow_0 procedure from Form Designer.

(For the 2 examples, make .pbf file ; resize the main window a little bit - 2/3 pixels)

Here is a code sample without Panel (working fine) :

Code: Select all

;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

Global Window_0

Global ListIcon_1, ListIcon_1_Copy1, Button_0

Declare ResizeGadgetsWindow_0()


Procedure OpenWindow_0(x = 0, y = 0, width = 578, height = 334)
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  ListIcon_1 = ListIconGadget(#PB_Any, 16, 16, 210, 306, "Column 1", 100)
  ListIcon_1_Copy1 = ListIconGadget(#PB_Any, 242, 16, 250, 306, "Column 1", 100)
  Button_0 = ButtonGadget(#PB_Any, 512, 298, 50, 25, "")
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected FormWindowWidth, FormWindowHeight
  FormWindowWidth = WindowWidth(Window_0)
  FormWindowHeight = WindowHeight(Window_0)
  ResizeGadget(ListIcon_1, 16, 16, 210, FormWindowHeight - 28)
  ResizeGadget(ListIcon_1_Copy1, 242, 16, FormWindowWidth - 328, FormWindowHeight - 28)
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindow_0()
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

This one with Panel (resize problem) :

Code: Select all

;
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

Global Window_0

Global Panel_0, ListIcon_1, ListIcon_1_Copy1, Button_0

Declare ResizeGadgetsWindow_0()


Procedure OpenWindow_0(x = 0, y = 0, width = 582, height = 394)
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  Panel_0 = PanelGadget(#PB_Any, 10, 6, 558, 368)
  AddGadgetItem(Panel_0, -1, "Tab 1")
  ListIcon_1 = ListIconGadget(#PB_Any, 18, 12, 210, 268, "Column 1", 100)
  ListIcon_1_Copy1 = ListIconGadget(#PB_Any, 234, 12, 250, 268, "Column 1", 100)
  Button_0 = ButtonGadget(#PB_Any, 484, 280, 50, 25, "")
  CloseGadgetList()
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected FormWindowWidth, FormWindowHeight
  FormWindowWidth = WindowWidth(Window_0)
  FormWindowHeight = WindowHeight(Window_0)
  ResizeGadget(Panel_0, 10, 6, FormWindowWidth - 24, FormWindowHeight - 26)
  ResizeGadget(ListIcon_1, 18, 12, 210, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 78)
  ResizeGadget(ListIcon_1_Copy1, 234, 12, GetGadgetAttribute(Panel_0,#PB_Panel_ItemWidth) - 308, GetGadgetAttribute(Panel_0,#PB_Panel_ItemHeight) - 78)
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindow_0()
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure



You can see that the 2 listicons are resized but the height and width decrease when you increase the window size just a little.

Have I done something wrong ?


EDIT : It seems there is a 8 pixels error with both height and width when the ResizeGadget is applied in ResizeGadgetsWindow_0() procedure.
Windows 10 Pro x64
PureBasic 6.04 x64