Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Cairoo
- Posts: 112
- Joined: Wed Dec 05, 2012 5:54 pm
Post
by Cairoo » Thu Feb 07, 2013 6:59 pm
Hi all
My datagrids keep losing their ability to hilight selected lines as soon as I resize the dataGrids using script.
I resize a datagrid by setting the group's width, height, top and left. I can't set the rect of the group because it makes my datagrid disappear off the screen.
All my datagrids' style is Table because I only need to display text.
What would be the correct way to go about resizing a datagrid without breaking it's hilight ability?
Thanks
Gerrie
Last edited by
Cairoo on Mon Feb 11, 2013 3:59 pm, edited 1 time in total.
-
Klaus
- Posts: 14213
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Thu Feb 07, 2013 7:12 pm
Hi Gerrie,
just memorize the hilited lines of your DG and restore it after resizing:
...
lock screen
put the dghilitedlines of grp "your dg here..." into tHL
## do your resizestuff...
set the the dghilitedlines of grp "your dg here..." to tHL
## or maybe use "the dghilitedindexes"
unlock screen
...
Best
Klaus
-
Cairoo
- Posts: 112
- Joined: Wed Dec 05, 2012 5:54 pm
Post
by Cairoo » Fri Feb 08, 2013 9:27 pm
Thanks Klaus.
I tried your solution and unfortunately the problem persists. However, I've created a separate test project, and for some reason the datagrid in the test project has no hilite problem, even without implementing your solution. I can't figure out what is different in the first project that might be causing the hilite problem.
I'm very reluctant to post my project here since it is proprietary. So I've recorded and uploaded a short video clip to my skydrive of what happens when I resize the datagrid. Perhaps some of you has seen this before and can offer some advice. Here's the link to the short video clip:
https://skydrive.live.com/redir?resid=8 ... 5NGBTkx9xc
- Gerrie
-
Klaus
- Posts: 14213
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Feb 10, 2013 12:12 pm
Hi Gerrie,
well, this is REALLY strange!?
But sometimes there ARE in fact gremlins in a stack, I experienced this by myself!
Maybe a field or whatever gets corrupted in very rare cases, and replaceing the object will fix it!
Best
Klaus
-
Cairoo
- Posts: 112
- Joined: Wed Dec 05, 2012 5:54 pm
Post
by Cairoo » Sun Feb 10, 2013 8:51 pm
Strange indeed.
I've removed the part of script that resizes the datagid, and even if I try to ONLY resize the controls not associated with any datagrid, it still breaks the datagrids' hilite.
My script attempts to avoid resizing any controls belonging to a DG by recursively checking the owner of the controls and then resizing a control only if a DG does not show up during the recursive owner check. It may be that my script does not correctly identify the hilite controls as being owned by a datagrid. Perhaps I need to change how I go about indentifying controls that are part of a datagrid? Or should I perhaps not iterate though all the controls on a card? How else would I be able to correctly scale the contents of the card? I would hate having to write a resize script for each individual control!
I've been suspecting my script, but if my script was to blame then how come it works in the test project? I've used the same approach in the test project, only with much less images and graphics. It can't be the images or graphics, right?
So much blood sweat and tears went into creating each object in the stack and all the handlers, that I would HATE having to replace the whole stack. I guess I'll just have to start replacing objects and see if it helps anything...
-
Cairoo
- Posts: 112
- Joined: Wed Dec 05, 2012 5:54 pm
Post
by Cairoo » Mon Feb 11, 2013 3:31 pm
I found the cause of the problem!
It happened because I set the lockLocation property of the datagrid to false before resizing and then to true after resizing.
Silly me!!!
At least now we know about one more thing we should never do:
Don't mess with a datagrid's lockLocation property when resizing it.
There.
Thanks to all of you who tried to help
- Gerrie
-
Klaus
- Posts: 14213
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Mon Feb 11, 2013 4:02 pm
Hi Gerrie,
AHA!
Glad you could solve your problem!
Best
Klaus