[Done] Too many objects in ResizeGadgets Procedure

You need some new stunning features ? Tell us here.
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

[Done] Too many objects in ResizeGadgets Procedure

Post by luciano »

I am using the latest beta to build a real application.
At present I have no older installation of Form Designer, so I don't know what happened in previous versions, but I believe there are too many gadgets in the Resize procedure.
Gadgets with only "lock left" and "lock top" options should not be inserted in the routine, causing useless flickering.
Only the bottom right image gadget is really "resizable"

Image

Code: Select all

Procedure ResizeGadgetsWindow_Main()
  Protected WindowWidth, WindowHeight
  WindowWidth = WindowWidth(Window_Main)
  WindowHeight = WindowHeight(Window_Main)
  ResizeGadget(#Text_Pilotaggio, 10, 140, 70, 20)
  ResizeGadget(#Text_Open, 15, 300, 70, 20)
  ResizeGadget(#Text_Current, 10, 50, 70, 20)
  ResizeGadget(#Text_Press, 10, 80, 70, 20)
  ResizeGadget(#Frame_Status, 5, 5, 170, 225)
  ResizeGadget(#Frame_SET, 180, 5, 150, 225)
  ResizeGadget(#Frame3D_Port, 5, 230, 225, 160)
  ResizeGadget(#Button_OPENCOM, 115, 285, 110, 30)
  ResizeGadget(#Button_CLOSECOM, 115, 320, 110, 30)
  ResizeGadget(#Key_Quit, 115, 355, 110, 30)
  ResizeGadget(#Text_Temp, 10, 110, 70, 20)
  ResizeGadget(#String_Current_SET, 185, 50, 85, 20)
  ResizeGadget(#String_Press, 185, 80, 85, 20)
  ResizeGadget(#String_TEMP, 185, 110, 85, 20)
  ResizeGadget(#Read_Curr, 85, 50, 80, 20)
  ResizeGadget(#Read_Press, 85, 80, 80, 20)
  ResizeGadget(#Read_Temp, 85, 110, 80, 20)
  ResizeGadget(#Light_Open, 15, 285, 60, 15)
  ResizeGadget(#Text_Hy_Low, 415, 245, 20, 20)
  ResizeGadget(#Text_Oxy, 440, 245, 20, 20)
  ResizeGadget(#Text_Hy_normal, 415, 225, 20, 20)
  ResizeGadget(#Text_Oxy_normal, 440, 225, 20, 20)
  ResizeGadget(#Text_Hy_TOP, 420, 180, 15, 20)
  ResizeGadget(#Text_Oxy_TOP, 440, 180, 15, 20)
  ResizeGadget(#Text_SEND, 55, 250, 20, 20)
  ResizeGadget(#Text_RECEIVE, 35, 250, 20, 20)
  ResizeGadget(#Text_SET_Send, 235, 145, 70, 20)
  ResizeGadget(#ProgressBar, 85, 140, 80, 15)
  ResizeGadget(#ListPorts, 85, 250, 140, 20)
  ResizeGadget(#Text_H2, 390, 255, 20, 20)
  ResizeGadget(#Text_O2, 465, 255, 20, 20)
  ResizeGadget(#STOP_Button, 245, 355, 80, 30)
  ResizeGadget(#START_Button, 245, 320, 80, 30)
  ResizeGadget(#Image_Port, 15, 250, 16, 16)
  ResizeGadget(#Image_Open, 95, 295, 16, 16)
  ResizeGadget(#Image_Close, 95, 330, 16, 16)
  ResizeGadget(#Image_Exit, 95, 365, 16, 16)
  ResizeGadget(#Image_Logo, 336, 284, 161, 116)
  ResizeGadget(#Image_Fan1, 390, 20, 48, 48)
  ResizeGadget(#Image_Compass, 15, 325, 64, 60)
  ResizeGadget(#Image_SetPoints, 190, 20, 16, 16)
  ResizeGadget(#Image_Read, 15, 20, 16, 16)
  ResizeGadget(#Image_C, 280, 105, 25, 25)
  ResizeGadget(#Image_BAR, 280, 75, 25, 25)
  ResizeGadget(#Image_AMP, 280, 45, 25, 25)
  ResizeGadget(#Image_PUMP, 345, 20, 48, 48)
  ResizeGadget(#Image_FAN2, 440, 20, 48, 48)
  ResizeGadget(#FrameSTATUS, 335, 5, 161, 270)
  ResizeGadget(#Text_Start_STOP, 350, 125, 140, 20)
  ResizeGadget(#Text_Alarm, 350, 150, 140, 20)
  ResizeGadget(#AmpereLabel, 505, 121, 90, 15)
  ResizeGadget(#dBarLabel, 505, 251, 90, 15)
  ResizeGadget(#TemperatureLabel, 505, 384, 90, 15)

  ResizeGadget(#ButtonImage_R, WindowWidth - 16, 380, 16, 16)

  ResizeGadget(#Matrix_1, 65, 15, 20, 20)
  ResizeGadget(#Matrix_2, 85, 15, 20, 20)
  ResizeGadget(#Matrix_3, 105, 15, 20, 20)
  ResizeGadget(#Matrix_4, 125, 15, 20, 20)
  ResizeGadget(#Matrix_5, 145, 15, 20, 20)
  ResizeGadget(#Text_Hy_hl, 415, 205, 20, 20)
  ResizeGadget(#Text_Oxy_hl, 440, 205, 20, 20)
  ResizeGadget(#Image_FAN2_ON, 725, 25, 48, 48)
  ResizeGadget(#Image_PUMP_ON, 725, 80, 48, 48)
EndProcedure
Last edited by luciano on Thu Jan 24, 2013 5:31 pm, edited 1 time in total.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Too many objects in ResizeGadgets Procedure

Post by Polo »

Makes sense, I'll try to optimise that this weekend when I get time! :)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Too many objects in ResizeGadgets Procedure

Post by IdeasVacuum »

.... I think the simple solution is to not have the lock values checked by default.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Too many objects in ResizeGadgets Procedure

Post by Polo »

IdeasVacuum wrote:.... I think the simple solution is to not have the lock values checked by default.
No a gadget is locked to the top/left by default (ie they're relative to it)
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Too many objects in ResizeGadgets Procedure

Post by BorisTheOld »

Yes, it's important to avoid any unnecessary resizing.

We have auto-resizing in our GUI classes. Currently, we can do vertical and horizontal resizing based on external margins and internal padding, and using fill, start, end, and centre modes.

The resizing process requires two passes, with the aim of identifying only those objects that need resizing. In our applications, resizing is triggered by a window being resized or by a splitter bar being moved.

The first pass starts with the parent object that has resized. It parses the GUI tree structure, recalculating new sizes and offsets for the child objects. The second pass performs the actual resizing of those objects whose size or location has changed. This helps reduce the amount of flicker.

In the future we plan to add minimum and maximum sizes to the GUI classes, and possibly some additional modes such as float and stretch.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Too many objects in ResizeGadgets Procedure

Post by Polo »

Should be fixed.
Post Reply