Resize items in Rows of Form

Moderators: heatherlaine, kevinmiller, robinmiller, Zryip TheSlug

Post Reply
hrcap
Posts: 131
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: 131
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
   --------



Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 163
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Resize items in Rows of Form

Post by Zryip TheSlug » Tue Sep 03, 2019 12:29 pm

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.
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Resize items in Rows of Form

Post by marksmithhfx » Sat Jan 09, 2021 1:11 pm

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
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Post Reply

Return to “Data Grid Helper”