TGComboBox

From Gestinux Wiki
Jump to navigation Jump to search

This control is a TCombobox, with a TLabel to display the caption, and a Translate procedure, as in all other data entry components

The items must not be set at designtime in lfm (the property should be removed in the future) but at runtime. The item texts must be set in the Translate procedure of the TGForm containing this TGComboBox, to fill items with translations in the current language. AddItem and InsertItem should be used associating a code independant of the language, to indicate the exact meaning of the item.


procedure TFormJournal.Translate;
var
 I: word;
 P: integer;
begin
 inherited Translate;
 // fill EditJournalClass PickList
 P := EditJournalClass.ItemIndex;
 EditJournalClass.Clear;
 for I := Low(JournalClass) to High(JournalClass) do
   EditJournalClass.AddItem(LibClassJournal(JournalClass[I]),
     IntToStr(JournalClass[I]));
 EditJournalClass.ItemIndex := P;
end;  

This is necessary to allow dynamic translation.

The button is on the right size of the box, unlike TGEditButton component. If possible, we will move it between the label and the box.

Other data entry components