Page 1 of 1

Filliing Option Buttons in DataGrid

Posted: Tue Feb 14, 2012 5:49 pm
by runrevGAf68e
This question has been asked many times in the forum. I've reviewed about 6 of them. Unfortunately, I'm still not getting it. My situation seems a little different.

I have the typical data grid with 2 columns. One of the columns is named "stpCol" and has a column behavior. This column should have an option button for every record in the grid. That option menu button is called "stpBtn". The "stpBtn" should be generated with a list of info that is generated on openStack of the main stack.

All of this works just fine - but for only the first row of the data grid. That option button in the first row has the right info in it. All subsequent rows' option buttons simply have "stpBtn" as the sole choice.

I've banged my head on this for about 12 hours. I have tried:
  • in the column behaviour : setting the text of the "templateButton". This had no effect
    In the openstack : setting the text of the "templateButton". This had no effect
    numerous ways to change when and how to generate the list that needs to go in the option menus.
    Simply setting the text of the btn in FillInData (what i'm currently using).

Code: Select all

## Behavior script generated by the DataGrid Helper's Script Builder
on FillInData pData
   global gStpOptions
   
   lock messages
   
   set the text of btn "stpBtn" to gStpOptions
   
   set the menuHistory of button "stpBtn" of me to lineoffset(pData,gStpOptions)
   
   RefreshList
   unlock messages
end FillInData
Please see atached image. Does anyone have suggestions on how to solve this problem?

Re: Filliing Option Buttons in DataGrid

Posted: Tue Feb 14, 2012 6:12 pm
by Klaus
Hi,

I think you forgot the keyword "OF ME" in one line:

Code: Select all

on FillInData pData
   global gStpOptions   
   lock messages
   
   ## HERE!
   set the text of btn "stpBtn" OF ME to gStpOptions  

   ## Correct in this line!
   set the menuHistory of button "stpBtn" of me to lineoffset(pData,gStpOptions)  
   RefreshList
   unlock messages
end FillInData
Best

Klaus

Re: Filliing Option Buttons in DataGrid

Posted: Tue Feb 14, 2012 6:33 pm
by runrevGAf68e
Klaus,

Wow. That was the issue. Thank you so much. I still don't understand how the first option menu was updated properly, but I just don't care at this point.

I must say, I haven't been very positive about LiveCode so far. However, I can say that the community is amazing. I've never received such immediate help from any other development community. Thank you all so much.

Thanks,
Justin

EDIT : About not feeling very positive: The main problem here is my lack of experience. It's really hard to like a new language / IDE when you know nothing. It's harder when you are trying to do something that would literally take 30 minutes in your language of choice. Of course, 8 years ago, I was pulling my hair out with PHP and HTML. So, I will get there. Hopefully, I will be a happy and contributing LiveCode community member some time down the road.

Re: Filliing Option Buttons in DataGrid

Posted: Tue Feb 14, 2012 6:43 pm
by mwieder
Give it about six weeks for it to kick in. The whole environment is different enough from other development platforms that the learning curve is about that long. Then there's no looking back.

And yes, this and the ruby community are the two most supportive user communities I've ever been involved with.

Re: Filliing Option Buttons in DataGrid

Posted: Tue Feb 14, 2012 7:20 pm
by FourthWorld
mwieder wrote:Give it about six weeks for it to kick in. The whole environment is different enough from other development platforms that the learning curve is about that long. Then there's no looking back.
Agreed. The pattern I see often with learning LiveCode looks something like this:

Day one: "What the hell is going on? Why doesn't anything work like I expect? I hate this damn thing."

Two days: "Omigawd, the potential is incredible! If only I knew how to use it all..."

Two weeks: "After reading the language guide and trying some things out, I'm able to do truly productive work."

One month: "Now I can do productive work efficiently."

Three months: "With the flexibility of the language and the handy tools in Revolution, I'm seeing slightly greater productivity than in my formerly-favorite tool I'd used for years."

Six months: "I love this thing."

One year: "I love this thing like no other."

Re: Filliing Option Buttons in DataGrid

Posted: Wed Feb 15, 2012 5:15 pm
by Klaus
Hi Justin,
runrevGAf68e wrote:Klaus,
Wow. That was the issue. Thank you so much. I still don't understand how the first option menu was updated properly...
Since you did not specify "OF ME", the script will only look for the FIRST button on the card with that name and fills it with data ervery time!
That's why only the first button gets "initialized".


Best

Klaus