SelectedText() returning empty string for DropDownListBox

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 empty 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 column with an edit style of DropDownListBox.

string userselected
userselected= dw_1.selectedtext( )
Messagebox("DW Selected text is: ", userselected)

Cause

N/A

Solution

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