Board index » delphi » TDBLookupCombobox in TDBCtrlGrid?

TDBLookupCombobox in TDBCtrlGrid?

Quote
>I want to use a TDBLookupCombobox in a TDBCtrlGrid. When I want to set
>the the Listsource property of the combobox I receive the error message
>"operation not allowed in a DBCtrlGrid" (at design and run time). How
>can I use TDBLookupCombobox in a TDBCtrlGrid?

What version of Delphi are you using?  I don't have any problem placing a
TdblookupCombobox in a tdbCtrlGrid with Delphi 4 and 5

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

 

Re:TDBLookupCombobox in TDBCtrlGrid?


In a DBCtrlGrid, the Datasource and Listsource properties of the controls in
it are not editable. These properties are controlled by the DBCtrlGrid.
However, the Listsource property is not found in DBCtrlGrid. Therefore, there
is no way to set the Listsource property of the DBLookupCombobox in a
DBCtrlGrid.

I think you should use DBCombobox instead, and add the field values to it by
code.
(I'm using D4 and have also experienced with this problem)

(P.S.: In my opinion, it is a bug in DBCtrlGrid, because it disallows the
editing of the Listsource property of the controls in it, which may be
different for each other. This property should be editable for controls in
the DBCtrlGrid. On the other hand, it is acceptable for the Datasource
property to be readonly.)

Brian Bushay TeamB

Quote
> >I want to use a TDBLookupCombobox in a TDBCtrlGrid. When I want to set
> >the the Listsource property of the combobox I receive the error message
> >"operation not allowed in a DBCtrlGrid" (at design and run time). How
> >can I use TDBLookupCombobox in a TDBCtrlGrid?

> What version of Delphi are you using?  I don't have any problem placing a
> TdblookupCombobox in a tdbCtrlGrid with Delphi 4 and 5

> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

Re:TDBLookupCombobox in TDBCtrlGrid?


Quote
Christian Laval wrote:
> I want to use a TDBLookupCombobox in a TDBCtrlGrid. When I want to set
> the the Listsource property of the combobox I receive the error message
> "operation not allowed in a DBCtrlGrid" (at design and run time). How
> can I use TDBLookupCombobox in a TDBCtrlGrid?

Try this (Maybe it works in D4 too):

- Open the FieldEditor of TQuery (DoubleClick)
- Add All Fields (Right Mouse Click)
- New Field
- Enter a name you want
- Enter Type (maybe String)
- Enter Fieldtype Lookup? (i have a german version so i dont know the real
caption)
- Fill out the Lookup-Fields
- if you ready then drag from the fieldeditor your new field to the
TDBCtrlGrid

Much luck
Alex

Other Threads