Capture selected ListViewItem with Openedge

4 posts, 0 answers
  1. Mark
    Mark avatar
    10 posts
    Member since:
    May 2016

    Posted 23 Nov 2016 Link to this post

    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

  2. Dimitar
    Admin
    Dimitar avatar
    2856 posts

    Posted 24 Nov 2016 Link to this post

    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.
  3. Mark
    Mark avatar
    10 posts
    Member since:
    May 2016

    Posted 24 Nov 2016 Link to this post

    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

  4. Dimitar
    Admin
    Dimitar avatar
    2856 posts

    Posted 25 Nov 2016 Link to this post

    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.
Back to Top