Filliing Option Buttons in DataGrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
runrevGAf68e
Posts: 22
Joined: Mon Dec 19, 2011 1:12 pm

Filliing Option Buttons in DataGrid

Post by runrevGAf68e » Tue Feb 14, 2012 5:49 pm

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?
Attachments
stpBtn.png

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Filliing Option Buttons in DataGrid

Post by Klaus » Tue Feb 14, 2012 6:12 pm

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

runrevGAf68e
Posts: 22
Joined: Mon Dec 19, 2011 1:12 pm

Re: Filliing Option Buttons in DataGrid

Post by runrevGAf68e » Tue Feb 14, 2012 6:33 pm

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Filliing Option Buttons in DataGrid

Post by mwieder » Tue Feb 14, 2012 6:43 pm

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.

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

Re: Filliing Option Buttons in DataGrid

Post by FourthWorld » Tue Feb 14, 2012 7:20 pm

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."
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Filliing Option Buttons in DataGrid

Post by Klaus » Wed Feb 15, 2012 5:15 pm

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

Post Reply