Page 1 of 1

Resize items in Rows of Form

Posted: Sat Jun 15, 2019 10:40 pm
by hrcap
Evening All

I hope that everyone is well.

I am working on my first datagrid and have a question regarding resizing...

I have a datagrid which I have set to 'Form' style to allow a bespoke look.


I have a script on the card where the datagrid is located to resize various items when the stack is resized....

I can get the overall datagrid to resize but I can only get the items in the first row of the datagrid to resize, the other rows remain un-resized.


This section successfully resizes the outside of the datagrid:

Code: Select all


   -- Datagrid
   
   set the height of group "datagrid" to the height of this stack / 2.28
   set the top of group "datagrid" to "155"
   set the width of group "datagrid" to the width of this stack
   set the left of group "datagrid" to "0"
   


This section is supposed to resize the items in each row of the datagrid but only resizes the items In the first row:

Code: Select all

-- graphic line_datagrid_divider
   set the width of graphic "line_datagrid_divider" of me to the width of this stack
   set the left of graphic "line_datagrid_divider" of me to "0"
   


I have also attached a couple of screenshots.


Many Thanks

Re: Resize items in Rows of Form

Posted: Sun Jun 16, 2019 10:17 am
by hrcap
..... It appears that getting some sleep made my research into how to solve this more productive.

For Reference for anyone else that gets stuck on this:

Within your resize script you have to specifically target the row template, make your changes, to the row template, and then refresh your row template.

I now have the following code in my stack resize script and it works perfectly:

Code: Select all


---
   --changes to the datagrid "datagrid_name" row template
   ## Get reference to group that serves as row template for data grid
   put the dgProps["row template"] of group "datagrid_name" into t_name_row_template
   
   
   ## Make any updates to template
   
   --line_name_datagrid_divider
   set the width of graphic "line_name_datagrid_divider" of t_name_row_template to the width of this stack
   set the left of graphic "line_name_datagrid_divider" of t_name_row_template to "0"
   
   --button "name"
   set the width of button "name" of t_name_row_template to the width of this stack - 7
   set the left of button "name" of t_name_row_template to "0"
   
   --field "name"
   set the width of field "name" of t_name_row_template to the width of this stack - 10
   set the left of field "name" of t_name_row_template to "0"
   
   
   ## Refresh the data grid
   dispatch "ResetList" to group "datagrid_name" 
   --End changes to the datagrid "datagrid_name" row template
   ---
   
   
   -- end of Datagrid name
   --------



Re: Resize items in Rows of Form

Posted: Tue Sep 03, 2019 12:29 pm
by Zryip TheSlug
Hi Hrcap,

Data Grid Helper (DGH) is a third party plugin. For questions relative to the datagrid control itself, prefer the beginners or experienced users forums, you have more chance to get answers.

Re: Resize items in Rows of Form

Posted: Sat Jan 09, 2021 1:11 pm
by marksmithhfx
hrcap wrote:
Sun Jun 16, 2019 10:17 am
..... It appears that getting some sleep made my research into how to solve this more productive.

For Reference for anyone else that gets stuck on this:

Within your resize script you have to specifically target the row template, make your changes, to the row template, and then refresh your row template.

I now have the following code in my stack resize script and it works perfectly:
This is really great information. Thanks for posting it.

Mark