Resize items in Rows of Form

Moderators: heatherlaine, robinmiller, kevinmiller, Zryip TheSlug

Post Reply
hrcap
Posts: 34
Joined: Mon Jan 14, 2019 5:20 pm

Resize items in Rows of Form

Post by hrcap » Sat Jun 15, 2019 10:40 pm

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
Attachments
1 Datagrid Normal Size.jpg
Datagrid resized.jpg

hrcap
Posts: 34
Joined: Mon Jan 14, 2019 5:20 pm

Re: Resize items in Rows of Form

Post by hrcap » 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:

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
   --------



Post Reply

Return to “Data Grid Helper”