PDA

View Full Version : Populating Multi-State Button


ABC123

Mortie
02-17-2007, 12:21 PM
is there a way to populate the text on a multi-state button using a field in a table, as in similar to populating a record combo box?

I need the numbers 02 - 99 on individual buttons. I can create the buttons by entering all the numbers but in the table itself not all the numbers would be present so I was hoping to find a way to have just the numbers in the table. My application itself is over 65 end users and the field itself would not always have the same combination of 02-99 numbers.

jkletrovets
02-17-2007, 02:15 PM
Bob

I don't use multistate buttons but I routinely change the text and color of text on normal buttons with this:

topparent:NAMEOFBUTTON.text="NEW Button Text"
topparent:NAMEOFBUTTON.font.color="Dark Green"


The help file for button properties might have the info for multistate buttons.

Regards,

Jeff

Steve Wood
02-24-2007, 03:29 PM
If you placed the following in the OnInit for the form, you'd get one button on object named MLTBTN1 with value Field1 for each record in "tableA".

DIM pObj AS P

pObj = topparent:MLTBTN1.this
pObj.settings.dynamic_list = table.external_record_content_get("tableA","Field1")

Mortie
02-24-2007, 11:29 PM
Steve, thanks for the suggestion. I am trying your suggestion changing the table and field name to that which is in my application.

The attached image shows the button is generated but there is no data. The button above the blank button is one that is hand coded by me for use in the master database. My application typically would want to place 6-8 buttons max on the button. There are 800K plus records in the table households, each with a field called district. Uniquely there should be 64 districts in this main database so there would be some that would show on your recommendation. The ultimate application database in the same format would have 120K records, each with a district field and some 6-8 unique district numbers across all the records.

Here is the code I entered

'Date Created: 24-Feb-2007 10:09:42 PM
'Last Updated: 24-Feb-2007 10:18:36 PM
'Created By : Bob
'Updated By : Bob

DIM pObj AS P

pObj = topparent:MLTBTN1.this
pObj.settings.dynamic_list = table.external_record_content_get("household","District")

Steve Wood
02-25-2007, 12:12 AM
I used MLTBTN1 as an example name, is your button named MLTBTN1?

Mortie
02-25-2007, 07:45 AM
I used MLTBTN1 as an example name, is your button named MLTBTN1?

Yes, at first I had it spelled wrong and the X-basic gave error message that object not found. Once I had the name the same as yours it created object you in the image.

So now I created another table with just one field, the district number I want on the button. The onInit event still creates the button as seen in the image but my code is changed to

'Date Created: 24-Feb-2007 10:09:42 PM
'Last Updated: 24-Feb-2007 10:18:36 PM
'Created By : Bob
'Updated By : Bob

DIM pObj AS P

pObj = topparent:MLTBTN1.this
pObj.settings.dynamic_list = table.external_record_content_get("districts","District")

There are 8 records in the new table, each a unique number.

Steve Wood
02-25-2007, 08:36 AM
Here, I created a small app with a multi-state button like you described.

Mortie
02-25-2007, 09:23 AM
Thanks

I see what you are doing now and will try to include it.