Retrieve the selected value from a listbox

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Retrieve the selected value from a listbox

Postby Upz » Sat Apr 01, 2017 9:26 am

Hi guys,
I'm studying and trying to learn alone. Could someone help me with a question?

In a FireMonkey Form Mobile I have a dB and a ListBox. To start the component I use LiveBinding Designer and the table has the following fields:
id
name
tel


I use the event OnItemClick and Item.Text, but, How I can find the "id"?

I saw one example for delphi, but how can i do the same with c++ builder?

The delphi example that i found is:
Code: Select all
function GetSelectedValue(AObject: TObject): TValue;
var
LEditor: IBindListEditorCommon;
begin
LEditor := GetBindEditor(AObject, IBindListEditorCommon) as IBindListEditorCommon;
Result := LEditor.SelectedValue
end;
Upz
 
Posts: 2
Joined: Mon Dec 23, 2013 4:37 pm

Re: Retrieve the selected value from a listbox

Postby rlebeau » Mon Apr 03, 2017 5:37 pm

Upz wrote:I saw one example for delphi, but how can i do the same with c++ builder?


Code: Select all
TValue __fastcall GetSelectedValue(TObject *AObject)
{
    _di_IBindListEditorCommon LEditor = GetBindEditor(AObject, __uuidof(IBindListEditorCommon));
    return LEditor->SelectedValue;
}
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1414
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Retrieve the selected value from a listbox

Postby Upz » Tue Apr 04, 2017 6:55 am

Thanks man!!!!!
:D :D :D
Upz
 
Posts: 2
Joined: Mon Dec 23, 2013 4:37 pm


Return to Technical

Who is online

Users browsing this forum: Yahoo [Bot] and 11 guests