Symptom

SelectedText() PowerScript function should return the text selected in a DropDownListBox (DDLB) control or datawindow column with a DropDownListBox Edit Style but only an emply string is returned.

Other controls tested all return the text correctly.

Environment

PowerBuilder

Reproducing the Issue

With a DropDownListBox with AllowEdit enabled according to the documentation the following code snippet should return the text of the item selected.

string userselected

userselected= ddlb_1.selectedtext( )

Messagebox("Selected text is:", userselected)

With a datawindow the following code snippet returns the text of the item selected for plain edit columns but returns an empty string for a colum with an edit style of DropDownListBox.

string userselected

userselected= dw_1.selectedtext( )

Messagebox("DW Selected text is: ", userselected)

Cause

N/A

 

Resolution

The itemchanged event on the datawindow, the data argument for the event will give the new value, see below

code snippet:

string changeddata

changeddata = data

With a simple ddlb control, you can get the value selected with the following code snippet:

string userselected

userselected= ddlb_1.text

3
0