![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Mon, Oct 20 2014 1:34 PM | Permanent Link |
TD Advanced Data Systems, Inc. | I created a dataset (using the Dataset Manager) named ds2. It is based in the following query:
SELECT code, description, code || ' ' || description AS apparatus FROM apparatus_use I placed a TCombobox on the form, set it's dataset property to ds2, I set it's datacolumn property to apparatus. On form create event I added - Database.Load(ds2); When I run the app the first item in the query shows in the TCombobox but when I select the dropdown of the TCombobox this value disappears and there isn't any values listed in the dropdown list of the TCombobox. What am I doing wrong? FYI, just to check I placed a grid on the form and set it to ds2. This grid shows all of the records returned by the query Thanks, TD |
Tue, Oct 21 2014 3:20 AM | Permanent Link |
Uli Becker | > When I run the app the first item in the query shows in the TCombobox but when I select the dropdown of the TCombobox this value disappears and there isn't any values listed in the dropdown list of the TCombobox.
That's normal, since you haven't defined any items for the drop-down list. You have to populate the items list yourself, e.g. Combobox1.items.clear; ds2.first; while not ds2.EOF do begin Combobox1.items.add(ds2.columns['MyColumn'].asString); ds2.next; end; Combobox1.itemindex := 0; Same in Delphi btw. Uli |
Tue, Oct 21 2014 10:38 AM | Permanent Link |
TD Advanced Data Systems, Inc. | > When I run the app the first item in the query shows in the TCombobox but when I select the dropdown of the TCombobox this value disappears and there isn't any values listed in the dropdown list of the TCombobox.
That's normal, since you haven't defined any items for the drop-down list. You have to populate the items list yourself, e.g. > Same in Delphi btw. Uli Ah, I have been spoiled because I use the TDBCombobox in Delphi which does this for you. Thank you for your help, TD |
Tue, Oct 21 2014 10:58 AM | Permanent Link |
TD Advanced Data Systems, Inc. | I am now getting a new error. Below is my code, attached is a screen capture of the error message. Also, if you load the items into a TCombobox "manually" then should you also set the Dataset and DataColumn properties of the TCombobox or just leave them blank?
procedure LoadCombobox1; begin Form1.Combobox1.items.clear; Form1.ds2.first; while not Form1.ds2.EOF do begin Form1.ComboBox1.items.add(Form1.ds2.columns['apparatus'].asString); Form1.ds2.next; end; Form1.Combobox1.itemindex := 0; end; I run this procedure on formcreate event. Attachments: EWB TCombobox Error.JPG |
Tue, Oct 21 2014 11:11 AM | Permanent Link |
Uli Becker | > Ah, I have been spoiled because I use the TDBCombobox in Delphi which does this for you. Thank you for your help,
I don't think that TDBCombobox does this for you. Maybe you mean TDBLookupCombobox. That's why I wrote "same in Delphi". Uli |
Tue, Oct 21 2014 11:17 AM | Permanent Link |
Uli Becker | > I run this procedure on formcreate event.
That cannot work, because the dataset hasn't been loaded yet and maybe Form1 hasn't be created yet. Place your code in the ds2.AfterLoad event handler. Be always aware that eveything runs in an asynchronous way - so make sure that a dataset has been loaded after doing something with the dataset. > should you also set the Dataset and DataColumn properties of the TCombobox or just leave them blank? If you want the field to be bound to the dataset, then yes. You should handle a TCombobox just like a TEdit component. You just have a list of values to choose with the TCombobox. Uli |
Tue, Oct 21 2014 11:36 AM | Permanent Link |
TD Advanced Data Systems, Inc. | Thanks a million Uli, that fixed it !
TD Uli Becker wrote: > I run this procedure on formcreate event. That cannot work, because the dataset hasn't been loaded yet and maybe Form1 hasn't be created yet. Place your code in the ds2.AfterLoad event handler. Be always aware that eveything runs in an asynchronous way - so make sure that a dataset has been loaded after doing something with the dataset. > should you also set the Dataset and DataColumn properties of the TCombobox or just leave them blank? If you want the field to be bound to the dataset, then yes. You should handle a TCombobox just like a TEdit component. You just have a list of values to choose with the TCombobox. Uli |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |