This is a migrated thread and some comments may be shown as answers.

Capture selected ListViewItem with Openedge

3 Answers 93 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 23 Nov 2016, 05:27 PM

Hello, I'm using Openedge 11.6. How do I go about capturing the selected item in a RadListbox and display it in another field? There is only 1 column and the details in the List are programmatically loaded. What I have below is displaying the Listbox object and not the selected items.

 

@VisualDesigner.
method private void radListView1_Click( input sender as System.Object, input e as System.EventArgs ):
    this-object:radtextbox2:text = cast(sender, Telerik.WinControls.UI.RadListView):text.
     return.
end method.

 

Also, is there a resource available with sample code for Openedge Visual Designer developers?

Thanks

Mark

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 24 Nov 2016, 08:57 AM
Hello Mark,

Thank you for writing. 

You can use the SelectedItem property for this:
this-object:radtextbox1:Text = this-object:radListView1:SelectedItem:Value:ToString().

Currently, our documentation contains only examples in C# and Visual Basic. However, this should not stop you to examine our documentation and search for the desired functionality. 

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
0
Mark
Top achievements
Rank 1
answered on 24 Nov 2016, 11:43 PM

Thanks Dimitar! It works but not exactly as I wanted though. I believe I need to use the method SelectedItemChange to display the row I am selecting. I moved the code you provided, it does work but now it's giving me an error(see below) just before the text is displayed in the field.

@VisualDesigner.
method private void radListView1_SelectedItemChanged( input sender as System.Object, input e as System.EventArgs ):
           this-object:radtextbox2:Text = this-object:radListView1:SelectedItem:Value:ToString().
return.
end method.

Error:

Lead attributes in a chained-attribute expression(a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)

 

What do you think?

Thanks
Mark

0
Dimitar
Telerik team
answered on 25 Nov 2016, 08:37 AM
Hi Mark,

You should check if the SelectedItem is null first:
METHOD PRIVATE VOID radListView1_SelectedItemChanged( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):
    IF  this-object:radListView1:SelectedItem NE ? then DO:
         this-object:radtextbox1:Text = this-object:radListView1:SelectedItem:Value:Tostring().
    End.
    RETURN.
END METHOD.

Please let me know if there is something else I can help you with. 

Regards,
Dimitar
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
Tags
ListView
Asked by
Mark
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Mark
Top achievements
Rank 1
Share this question
or