Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 16 total
Thread TButtonCombo & Datasets
Wed, Oct 28 2015 2:40 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

I have the following String  s :

{"rows":[{"name":"System Admin","id":1},{"name":"Client Admin","id":2},{"name":"Client Stats","id":3
}]}

(passes json validator here and looks right - cut & paste : http://jsonlint.com/)

and I'm doing
   myDataSet.Open;
   myDataSet.LoadRows(s);

and I get no errors. So far so good.

I have a TButtonCombo control bound to this dataset. All that happens after the load is the combo is blank (the initial "Caption" string is deleted which is how I know its doing *something*)

The dataset is set correctly.
The Datacolumn is set correctly to "name"
The dataset itself has two items, id (int) and name (string)

Why on earth does that not load? Am I missing an obvious step? I use this technique all the time for grids.
Wed, Oct 28 2015 2:53 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

attached is a sample project with it happening.
Any help gratefully received as I've been staring at this for 3 hours.

Nearly out of hair as it is ...



Attachments: combodatasettest.zip
Wed, Oct 28 2015 4:00 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 10/28/2015 2:40 PM, squiffy wrote:
> I have a TButtonCombo control bound to this dataset. All that happens after the load is the combo is blank (the initial "Caption" string is deleted which is how I know its doing *something*)
> The dataset is set correctly.
> The Datacolumn is set correctly to "name"
> The dataset itself has two items, id (int) and name (string)
> Why on earth does that not load? Am I missing an obvious step? I use this technique all the time for grids.

Did a quick test and seeing same here - no items in combo.

I have a dataset attached to a tgrid and TButtonComboBox and seeing data
in grid properly so dataset is open and has data.

TEditComboBox similarly has an issue - it updates the displayed active
record value but does not allow dropdown (list empty).


Need Tim to take a look.

Raul
Wed, Oct 28 2015 4:02 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

Thanks Raul. Nice to know I'm not going mad!

I've worked around it for now by manually populating the list from the DS.
Wed, Oct 28 2015 4:25 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< Why on earth does that not load? Am I missing an obvious step? I use this technique all the time for grids. >>

If you don't have any items defined for the combo box, then the button combo box won't display any text because the database column's value doesn't match any values in the button combo box.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Oct 28 2015 4:26 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Raul,

<< TEditComboBox similarly has an issue - it updates the displayed active record value but does not allow dropdown (list empty). >>

If there are no items in the list for the TEditComboBox, then what I see here is a small, empty drop-down list, as expected.

IOW, I'm not seeing anything wrong here with either the TButtonComboBox or TEditComboBox.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Oct 28 2015 4:29 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

So how do I populate an empty combo box from a dataset?
Wed, Oct 28 2015 4:35 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

Sorry Tim, I'm clearly missing something here.

If the dataset gets loaded from the json string and the combo box is databound to it, and the datacolumn is set to the correct json field, shouldnt that do it?

How else should I set up the combo box, as i dont have any data for it until the json is returned?
Wed, Oct 28 2015 4:43 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 10/28/2015 4:26 PM, Tim Young [Elevate Software] wrote:
> IOW, I'm not seeing anything wrong here with either the TButtonComboBox or TEditComboBox.

Tim,

Then i'm confused as to how to use TButtonComboBox DataSet and
DataColumn fields and/or what they mean.

I looped thru the dataset and added all the string items into the combo
Items collection - doing it manually is big PITA though.

Now whenever I navigate with grid the TButtonComboBox text does change.

I can also select drop down and i see all entries.

However i can't seem to change the current record from TButtonComboBox -
clicking entry in drop down does nothing (now that might be a table
index issue - the int value is primary index not string).

Raul
Wed, Oct 28 2015 8:56 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 10/28/2015 4:43 PM, Raul wrote:
> Then i'm confused as to how to use TButtonComboBox DataSet and
> DataColumn fields and/or what they mean.

Tim,

Never mind - i was looking at it wrong. Doh!

In dataset browse mode it essentially acts as display (label) only - as
long as value is in the Item list.

If dataset is in edit mode you can use it to update value for the linked
dataset field and set it to one of the values in the item list.

Raul


Page 1 of 2Next Page
Jump to Page:  1 2
Image