Populating groups with data

Mark Smith mark at maseurope.net
Sat Feb 4 21:23:22 EST 2006


And if you didn't know, when a control is created (ie. cloned), rev  
put's whatever it's current name is into the 'it' variable, so you  
can immediately position and rename it, so you could do some thing like:

put 10 into tTop -- will be the top of the new group
put 10 into tLeft -- will be the left
repeat with n = 1 to the number of lines in taskList
	clone group "Tasktemplate" -- maybe have  your group "hidden"  
somewhere in the stack
	set the top of it to tTop
	set the left of it to tLeft
	put the bottom of it + 10 into tTop
	show it
	set the name of it to "Task" & n
	--- you could fill the each group with data at this point

Mark

On 5 Feb 2006, at 00:42, Josh Mellicker wrote:

> Hi Sarah,
>
> Thanks so much for the reply!
>
> The groups have not been created, so I need to clone a group for  
> each task... but your code certainly gives me a clear path to follow.
>
> Thanks!
> Josh
>
> On Feb 4, 2006, at 2:51 PM, Sarah Reichelt wrote:
>
>>> I have data returned from a PHP script, like this:
>>>
>>> total number of tasks: 4
>>> project_id: 3|take trip|task_id: 47|get cookies|vanilla wafers,
>>> oreos, choc chip|duncan|3|
>>> project_id: 3|take trip|task_id: 46|buy funny hats|all kinds of  
>>> hats|
>>> duncan|3|
>>> project_id: 3|take trip|task_id: 40|buy bikes|cool bikes!|duncan|3|
>>> project_id: 3|take trip|task_id: 48|get shiny stuff|shiny|duncan|3|
>>>
>>>
>>> I want the data to populate a scrolling group of groups that will
>>> look something like this:
>>>
>>> http://revcoders.org/populating-groups-with-data/
>>
>> How about something like this:
>>
>> put last word of tPHPdata into tNumGroups
>> delete line 1 of tPHPdata
>>
>> set the itemDelimiter to "|"
>> repeat with g = 1 to tNumGroups
>>   put line g of tPHPdata into tLineData
>>   put item 2 of tLineData into field "ProjectName" of group  
>> ("Task" & g)
>>   put item 4 of tLineData into field "TaskName" of group ("Task" & g)
>>   put item 5 of tLineData into field "TaskDetails" of group  
>> ("Task" & g)
>>   put item 6 of tLineData into tTaskOwner
>>   if btn "TaskOwner" of group ("Task" & g) contains tTaskOwner is  
>> false then
>>     put cr & tTaskOwner after btn "TaskOwner" of group ("Task" & g)
>>   end if
>>   get lineOffset(tTaskOwner, btn "TaskOwner" of group ("Task" & g))
>>   set the menuHistory of btn "TaskOwner" of group ("Task" & g) to it
>> end repeat
>>
>>
>> This assumes that all the groups have been created and are called
>> "Task1", "Task2" etc. If they don't already exist, you need to clone
>> them and position them. If you make lots in advance, you may want to
>> show & hide them depending on how many are full.
>>
>> BTW, I wasn't sure what all the data segments in your PHP data were,
>> but this should give you enough to display the rest wherever you need
>> them.
>>
>> Cheers,
>> Sarah
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list