Forum Discussion

singhapratim's avatar
singhapratim
New Contributor
8 years ago

How to set a text in a dropdown datawindow field in a powerbuilder application

Hi,

I am unable to set a text or select one of the value from the dropdown datawindow.

 

Here is the code:

function Test(){

//Run the "performmed" tested application.

TestedApps.performmed.Run();

//With this. the Drop down datawindow field is clicked and the Dropdown menu popped up

Aliases.performmed.wndFNWND312516.MDIClient.wndFNWND3125.none.Click(154,9);

 

//After this, How can I select a value of the DropDown Datawindow without triggering a click.

 

}

 

Can anyone please suggest the solution.

6 Replies

    • Ryan_Moran's avatar
      Ryan_Moran
      Valued Contributor

      You can probably just send keys to it in that case.

       

      object.keys("whateveritem")

  • With keys([Up]), I can select the row which is one row up to the default row selected.

    For example, Consider a Dropdown Datawindow field, with the list as follows:

    1. SmartBear1

    2. SmartBear2

    3. SmartBear3

    4. SmartBear4

    5. SmartBear5

    Row #3 (SmartBear3) is selected by default.

    Now If I execute Keys([Up]), it successfully selects Row #2 (SmartBear2).

    But consider the requirement to select Row #1, I tried with Keys([Up][Up]), it stills selects Row #2 (SmartBear2).

    Please suggest if there is any way to solve this.

     

    Second Question,
    Is there any way to directly set "SmartBear1" in the DropDown Datawindow Field.

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      I've never worked with these PowerBuilder data dropdowns, but from what I can see, they are data driven. The data displayed it determined by a query to a DB. I have similar types of dropdowns in my Delphi app and they are not as simple to work with a standard one with static data.

       

      Can you post an image of the properties of the object? Does it have a "DataSet", "DataSet", "RecordSet" object or something like that?

       

      It's quite possible that the data you actually select is actually separate to the DropDown object it's presented in. Which is why only get a Click with co-ordinates back from your recording rather than a meaningful select.

       

      Speaking of meaningful, your Alias names and structure are not nice. You want to be renaming those to make them more understandable in the context of the application. (And also dropping any invisible containers which are not really of any use except for presentation purposes ...)