How do I create a data grid with a variable height?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Linh
Posts: 16
Joined: Sun Mar 27, 2011 2:46 pm

How do I create a data grid with a variable height?

Post by Linh » Tue Nov 01, 2011 4:22 am

Hello,

I need to create a data grid with a variable height (variable height of the data grid, not height of lines in data grid).
Note: This data grid is in a line of another data grid. I thought it's similar to create a variable line heights, but it did not work in my case.
This is my code:

Code: Select all

   
   put the rect of group "dtgReport" of me into tFieldRect
   put item 3 of pControlRect - 5 into item 3 of tFieldRect
   set the rect of group "dtgReport" of me to tFieldRect
   
   put (item 2 of tFieldRect) + (the formattedheight of grp "dtgReport" of me) - (the bottommargin of grp "dtgReport" of me) \
         into item 4 of tFieldRect
   set the rect of group "dtgReport" of me to tFieldRect
   
   put item 4 of tFieldRect into item 4 of pControlRect
Your help is greatly appreciated.

Cheers,
Linh

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Mon Nov 21, 2011 1:44 am

Linh wrote:Hello,

I need to create a data grid with a variable height (variable height of the data grid, not height of lines in data grid).

Cheers,
Linh
set the height of group "my_datagrid" to new_height

where "new_height" is a variable with your new height value.

-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Mon Nov 21, 2011 5:52 am

I guess if you are in the datagrid you could also "set the height of me to whatever" but I'm not sure. I haven't really figured out the "me" thing yet and still think in very concrete terms about objects. I probably just have trouble with abstraction. :o

Cheers,
-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

cbodell
Posts: 61
Joined: Wed Nov 09, 2011 7:27 pm

Re: How do I create a data grid with a variable height?

Post by cbodell » Mon Nov 21, 2011 1:54 pm

Hi Mark,

A little late for an update here, just wanted to let you know that the term "me" refers to the object or control that holds the handler or script being invoke/ran. Example, If a "mouseUp" handler is in a button, then you can use the reference to "me" within that mouse up handler instead of calling to/from that button specifically by name or ID.

Hope that Helped!

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Mon Nov 21, 2011 3:27 pm

cbodell wrote:Hi Mark,

A little late for an update here, just wanted to let you know that the term "me" refers to the object or control that holds the handler or script being invoke/ran. Example, If a "mouseUp" handler is in a button, then you can use the reference to "me" within that mouse up handler instead of calling to/from that button specifically by name or ID.

Hope that Helped!
Thanks Chris,
It seems simple enough, doesn't it. But when you have been writing code for 30+ years from a perspective that is outside of everything (ie. beginning with Fortran back in 1973) its extremely difficult to adopt the mindset of writing code from the "inside" of something (ie. inside a button, inside a card, etc). Hey, I've only been at this for two years... I'll get it eventually :)

Actually, the hardest part for me has been trying to remember where I put stuff and being able to scan or review all of my code in one place. Its a mindset that I'm convinced is more suited to a younger generation :)

-- M
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How do I create a data grid with a variable height?

Post by FourthWorld » Mon Nov 21, 2011 6:19 pm

marksmithhfx wrote:
cbodell wrote:Actually, the hardest part for me has been trying to remember where I put stuff and being able to scan or review all of my code in one place. Its a mindset that I'm convinced is more suited to a younger generation :)
Or perhaps a much older generation: a good many LiveCode users cut their teeth on HyperCard some 20 years ago.

If you need to search across all scripts you're welcome to use my 4W Script Search tool. You'll find it in the Stacks section of RevNet - in LiveCode see Development->Plugins->Go RevNet
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

cbodell
Posts: 61
Joined: Wed Nov 09, 2011 7:27 pm

Re: How do I create a data grid with a variable height?

Post by cbodell » Mon Nov 21, 2011 10:17 pm

Hi Guys

Sorry to turn the post over like this. 8)

MarkSmith,
I would understand the difficulty there, i've been coding for 5 years, so i'm still learning myself. If you have difficulty there, as in coding from objects, you could always write code on the cards or stacks, and base actions up the targets for that handler! That way it would all be in one place. But i'm sure that could get a frustrating.

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Tue Nov 22, 2011 4:27 am

FourthWorld wrote:Or perhaps a much older generation: a good many LiveCode users cut their teeth on HyperCard some 20 years ago.

If you need to search across all scripts you're welcome to use my 4W Script Search tool. You'll find it in the Stacks section of RevNet - in LiveCode see Development->Plugins->Go RevNet
Thanks Richard. I will take you up on the generous offer. 20 years ago? Remember TBBS? I was writing dbase code for TBBS systems, ran a BBS and had many users who were into Macs and Hypercard. Unfortunately I did not take the plunge back then when the grey matter was still a little more pliable :) (However, the more I learn the more fun it becomes.... with much appreciation to all the generous folks here who help out)

-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Tue Nov 22, 2011 4:42 am

cbodell wrote:Hi Guys

Sorry to turn the post over like this. 8)
Ah well, back to work is it :D

Speaking of pushing code up the message path, I ran across an excellent example of that tonight in Sarah Reichelt (TROZware) Calendar Demo 1.6. She has 31 buttons available on the card (as needed) and clicking on them causes things to happen. But there is not a lick of code in any of them. Ah, I said, the Card then but nope, had to climb all the way to the stack before I found mouse up/down handlers. I would find that a mental stretch, but it does allow her to have a single set of mouse handlers to handle all "calendar day" button presses. Very clever actually.

-- M
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Tue Nov 22, 2011 4:53 am

FourthWorld wrote:If you need to search across all scripts you're welcome to use my 4W Script Search tool. You'll find it in the Stacks section of RevNet - in LiveCode see Development->Plugins->Go RevNet
Wow Richard, revnets an incredible resource. Thanks for point that out. (and I just saw Sarah's Calendar demo listed in the stacks as well, along with 4W_SearchScript. Small world)

-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

cbodell
Posts: 61
Joined: Wed Nov 09, 2011 7:27 pm

Re: How do I create a data grid with a variable height?

Post by cbodell » Tue Nov 22, 2011 8:22 am

MarkSmith,

I agree, clever indeed. I like the library stack function, & insert script function. That way you can have before during and after handlers in a sense.
I don't use Mac systems, and i did start until around Rev 2.8.1, but i did get a hold of the HyperCard App, i like the setup. Actually, i like how universally Rev/LiveCode has grown. I wish they would have a way to embed the Revlets on these forums though, that's a good idea i think!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How do I create a data grid with a variable height?

Post by FourthWorld » Tue Nov 22, 2011 4:23 pm

marksmithhfx wrote:20 years ago? Remember TBBS?
I don't recall it, but I remember Wildcat BBS fondly. Until FirstClass came along, then the local Mac User Group switched to that and at last we had a GUI collaboration toolkit. Funny, the things we used to do before the Web.
I was writing dbase code for TBBS systems, ran a BBS and had many users who were into Macs and Hypercard. Unfortunately I did not take the plunge back then when the grey matter was still a little more pliable :) (However, the more I learn the more fun it becomes.... with much appreciation to all the generous folks here who help out)
I've been spending a lot of time with JavaScript over the last two years, in many ways a chance to become a beginner again (so much has changed since I'd last used it for any serious projects). Definitely good to flex the learning muscle now and then.
marksmithhfx wrote:
FourthWorld wrote:If you need to search across all scripts you're welcome to use my 4W Script Search tool. You'll find it in the Stacks section of RevNet - in LiveCode see Development->Plugins->Go RevNet
Wow Richard, revnets an incredible resource. Thanks for point that out. (and I just saw Sarah's Calendar demo listed in the stacks as well, along with 4W_SearchScript. Small world)
Glad that was helpful. I have some significant enhancements in the works for RevNet, and while my client projects make it difficult for me to say exactly when I'll be able to roll those out, if you like RevNet now you'll like it a whole lot more in the coming months.

In the meantime, be sure to check out RevOnline as well. It's RunRev's stack sharing system built right into the IDE, and there's a treasure trove of goodies to be discovered there.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: How do I create a data grid with a variable height?

Post by marksmithhfx » Wed Nov 23, 2011 6:16 am

cbodell wrote:MarkSmith,

I like the library stack function, & insert script function. That way you can have before during and after handlers in a sense.
I've been reading a bit about library stacks on this forum but had not heard about the insert script option. So much to learn!
-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Post Reply