Page 1 of 1
populate data grid and keep the hilite state of checkboxes
Posted: Mon Feb 17, 2014 11:18 am
by keram
Hello,
In the attached stack I have text lines belonging to 3 categories that can be selected with 3 checkboxes.
After selecting the categories when you click the button 'Lines of Selected Categories' the data grid should populate with the lines in selected categories.
However it does not as it is now.
If I disable the line 'set the hilite of btn "BtnCheck" of me to pDataArray["BtnCheck"]' in the 'FillInData pDataArray' handler in the button 'Behavior Scrip' then the data grid gets populated and I get everything, but the checkboxes do not hold the hilite states, i.e when I click on 'Wrap o/x' button the selections disappear.
How to correct the code to populate the dg and have the checkboxes maintain the hilite state?
keram
Re: populate data grid and keep the hilite state of checkbox
Posted: Mon Feb 17, 2014 11:21 pm
by Zryip TheSlug
Hi Keram,
When you are preparing the data for populating the datagrid, you are omitting the second column of your group named "data".
Your code should be:
Code: Select all
repeat for each line i in AllLines
if item 3 of i is among items of gMyCategories then put item 1 of i &tab& item 2 of i & tab & \
item 3 of i &tab& item 4 of i &cr after LinesInMyCategories --lines in selected categories
end repeat
You have to store the state of the checkboxes in the second column of your "data" group to have them revert back when you are populating the datagrid.
Best,
Re: populate data grid and keep the hilite state of checkbox
Posted: Tue Feb 18, 2014 4:34 am
by keram
Hi TheSlug,
Thanks for your help! It works OK now
(Yes, I missed that item...

)
Now I have increased the number of lines to over 600.
Is there any way to make the refreshing of the view and the toggling of the wrapping of the grid more speedy?
I'm attaching the corrected stack with 640 lines.
keram
Re: populate data grid and keep the hilite state of checkbox
Posted: Tue Feb 18, 2014 8:30 pm
by Zryip TheSlug
Now I have increased the number of lines to over 600.
Is there any way to make the refreshing of the view and the toggling of the wrapping of the grid more speedy?
I done a quick test, and drawing the datagrid is just immediate for me.
However you can try this:
- adding a "lock screen" before to change the wrap:
Code: Select all
on mouseUp --toggle dontWrap t/f
local tNewSetting, tRowTemplateRef
lock screen
put not the dgProp["fixed row height"] of grp "DataGrid 1" into tNewSetting
set the dgProp["fixed row height"] of grp "DataGrid 1" to tNewSetting --toggle t/f fixed line height
put the dgProp["row template"] of grp "DataGrid 1" into tRowTemplateRef
set the dontWrap of fld "Label" of tRowTemplateRef to tNewSetting
set the dgVScroll of grp "DataGrid 1" to 0 --top
send "ResetList" to grp "DataGrid 1" --update changes
unlock screen
end mouseUp
- having a look to the following lesson:
http://lessons.runrev.com/s/lessons/m/d ... t-is-false
Best,
Re: populate data grid and keep the hilite state of checkbox
Posted: Wed Feb 19, 2014 2:02 am
by keram
Thanks again TheSlug,
Great tip!
Zryip TheSlug wrote:and drawing the datagrid is just immediate for me
Perhaps your computer is faster. In my case there some noticeable improvement.
Without the 'lock screen' it would expand in 2 steps:
this is no-wrapping view:
this is first stage when I click on Wrap button - it's visible just for a fraction of second:

- 2.png (10.5 KiB) Viewed 3852 times
and this is when the lines are wrapping:

- 3.png (11.05 KiB) Viewed 3852 times
So it's quite a difference.
keram