You are hereHow can I make a selection list?

How can I make a selection list?


By soky - Posted on 14 July 2009


I want to make a simple selection list: one column, several rows, zero fixed row.

I tried a string grid, investigated how can I fill it. But can't guess how ask them about current row index.

I switched to twidgetgrid and dropped a tstringedit and fill it date. I can read the value of actual row but I can't fire any event on selection.

The news isn't working (for me) so please help me somebody!

Thanks,

Zsolt

> But can't guess how ask them about current row index.

Use t*grid.row.

> but I can't fire any event on selection.

Use t*grid or t*grid.datacols[n].onselectionchanged or oncellevent, check for cek_select.

But why don't executing onselectionchanged which is "bubu2" in my attached project?

AttachmentSize
sp2-090714.zip 6.62 KB

Because the selection does not change. ;-)
Activate the appropriate flags t*grid.datacols.options co_focusselect, co_keyselect, co_multiselect, co_rowselect.

Thank you!

The event fired up but the actual value isn't the selected.

I think I'll go back to stringgrid and I'll play with row property...

Please don't confuse selected cell(s) and focused cell. Focused cell is in t*grid.focusedcell and/or col/row properties, selected cells are in different tdatacol.selected* or tdatacols.selected* properties. You probably could use t*grid.oncellevent and
"
procedure tmainfo.selectcelleevent(const sender: TObject; var info: celleventinfoty);
begin
if iscellclick(info) then begin
//do something with info
end;
end;
"

Thank you I'll try oncellevent way.

But is there any other widget for this? (select from a list, nothing edit)

What about tlistview? Can I configure to iconless and multi column?

Please help me in the starting step: config, fill, select, retrieve.

Zsolt

Use tdropdownlistedit or a readonly tstringgrid.

Please help me in usage of tdropdownlistedit. (news server don't work again)

How can I load a list into them?

Or show general investigating method about properties and methods of any object. I usually try the ctrl+space which bring a list (similarly to delphi) and ctrl+leftclick which take me to definition of object under cursor. But isn't enough for me because my knowledge level :( I miss the documentation but I hope I will "Use the force, read the source!" :)

Zsolt

> news server don't work again

Works for me.

> How can I load a list into them?

Use
tdropdownlistedit.dropdown.cols.addrow(['col0text','col1text'...]), insertrow() or one of the methods of tdropdownlistedit.dropdown.valuelist (add(), insert(), fill(), asarray, assignarray(), loadfromfile()...).

> I miss the documentation but I hope I will "Use the force, read the
> source!"

Please write your findings to
http://www.msegui.org/documentation
or
http://wiki.freepascal.org/MSEide_&_MSEgui
or
http://wiki.freepascal.org/Reference:_MSEgui
the question was asked several times.