[Delphi] Jak ustawic w DBLookupComboBox dana wartosc edycji

0

Jak ustawic widoczna wartosc w DBLookUpComboBox ze np
ma w gridzie jakies linijki z danymi klikam sobie na linie nr 3
i otwiera mi sie nowe okienko z CBLUCB i jak teraz ustawic wartosc
np 4 zeby sie wyswietlala nazwa gdzie pole KEY = 4

bo ten komponent wybiera mi pole KEY kiedy wybieram cos z niego
ale jak zrobic to w druga strone ?

0

dclcb.DataSource.DataSet.Locate('nazwa_pola_id', VarArrayOf(['wartosc']));

0
Misiekd napisał(a)

dclcb.DataSource.DataSet.Locate('nazwa_pola_id', VarArrayOf(['wartosc']));

a nie dałoby się jaśniej?? tak, żeby początkujący też zrozumieli?
czy dclcb to skrót od DBLookupComboBox?? (tylko jedna literka w skrócie by się nie zgadzała)
gdzie to należy wpisać, żeby działało?? przy zdarzeniu OnClick??

0

F1 w Delphi też pomaga

Searches the dataset for a specified record and makes that record the current record.

Delphi syntax:

function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions): Boolean; override;

C++ syntax:

virtual bool __fastcall Locate(const AnsiString KeyFields, const System::Variant &KeyValues, TLocateOptions Options);

Description

Call Locate to search a dataset for a specific row and make it the current row.

KeyFields is a string containing a semicolon-delimited list of field names on which to search.

KeyValues is a variant that specifies the values to match in the key fields. If KeyFields lists a single field, KeyValues specifies the value for that field on the desired row. To specify multiple search values, pass a variant array as KeyValues, or construct a variant array on the fly using the VarArrayOf routine. For example:

with ADOTable1 do
Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
TLocateOptions Opts;
Opts.Clear();
Opts << loPartialKey;
Variant locvalues[2];
locvalues[0] = Variant("Sight Diver");
locvalues[1] = Variant("P");
CustTable->Locate("Company;Contact", VarArrayOf(locvalues, 1), Opts);

Options is a set that optionally specifies additional search latitude when searching on string fields. If Options contains the loCaseInsensitive setting, then Locate ignores case when matching fields. If Options contains the loPartialKey setting, then Locate allows partial-string matching on strings in KeyValues. If Options is an empty set, or if KeyFields does not include any string fields, Options is ignored.

Locate returns true if it finds a matching row, and makes that row the current one. Otherwise Locate returns false.

na FAQ też się znajdują pomoce:

http://4programmers.net/Delphi/Artyku%C5%82y/Oracle_10g_i_Delphi_7._Programowanie_baz_danych#id-Metoda-Locate

0

hmm, chyba jestem zbyt początkujący żeby to zrozumieć... a w dodatku opis po angielsku... może kiedyś to zrozumie albo ktoś mi to jaśniej przedstawi.
pozdrawiam

1 użytkowników online, w tym zalogowanych: 0, gości: 1