Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Power Cobol combo box 1

Status
Not open for further replies.

cityosh

Programmer
Feb 5, 2004
4
US
We are starting to use Fujitsu Powercobol v7 and have been using Fujitsu Netcobol v6 and v7 for a while. The question I have is what is the code needed to show in a combo box the current value of the record? I know how to add to it using the addstring method and it works when the combobox is set to simple. But simple looks bad because it has a text box on top and then a list box below it all the time. This takes up too much screen area. I just want to use a dropdownlistbox and then when a user pulls up a record to display the value in the record in the listbox and then if the user wants to change it they can scroll down using the arrow. I don't think this is a lot to ask. Any ideas? This is very basic in VB or PowerBuilder.
 
Cityosh,

Not sure I undersood your question however, I will make a stab. If you are trying to control which entry in your combo box is currently selected (and hopefully displayed), you might try setting the ListIndex property.

ListIndex Property

Description: Contains the index of the selected item in the list box part.

Value: The index of the selected item. The value is an integer from 1 to the value of the ListCount property.
0 means nothing is selected.

You can set this property manually from you program after adding the item to the combo box.

I have used this in a simple and dropdown combo box to cause the specific line item to be selected.

AddString then
Retrieve the ListCount (number of entries in comboBox)
Set ListIndex to the value retrieved from ListCount.

This will cause the last entry in the combo box to be selected.

Hope this is what you were looking for.

etom
 
That is what I am trying to do, but the value is not the first item in the list. So are you saying that to display the value from the record I will have to search one by one through the list to find the value and then set the listindex to it so it will display every time I display a record? I suppose I could have an evaluate statement and evaluate the value after the retrieve to figure out what number to set the listindex to. This would work since the list is a fixed set of different values.
 
Ok,

Now I understand what you are doing and yes, your Idea would do the trick. You have to have some way of knowing what to set the ListIndex to in order to do what you want to do.

etom
 
You may want to look at the FindString method. It can be used to locate the index of the first item matching the string provided as an argument. Combine it with ListIndex to easily select the item that is represented in the record.

Regards.

Glenn
 
Glenn,

I wish there was a findstring method for the combobox. There is not so I used an evaluate. I am using Fujitsu Powercobol v7. I can see this is going to be needed for every combo box used. It is too bad you can't just set a property of the combo box to show the current value or be able to move the value.

Pete


EVALUATE ORG-TYPE
WHEN 'C'
MOVE 1 TO "LISTINDEX" OF CMCOMBOORG
WHEN 'I'
MOVE 2 TO "LISTINDEX" OF CMCOMBOORG
WHEN 'P'
MOVE 3 TO "LISTINDEX" OF CMCOMBOORG
END-EVALUATE.
 
Hi Pete

I don't know if you have resolved your combo problem, but it depends from the way you set the combo.(Dropdown, Droplist).

Normally, to retrieve and show a combo item, you can use (as already mentioned in the above posts) the "ListIndex" property, that contains the index of the selected item.
To show its value you can handle "Listindex" value saving it in a field, then show the string selected, like below:

MOVE "ListIndex" OF CMCOMBO1 TO DUMMY
MOVE "ListString" (DUMMY) OF CMCOMBO1 TO "TEXT" OF CMCOMBO1
(or where you want to show the string value)

I hope in this help. If not please, send me an email to softline2000@tin.it, explaining better what you need.

Regards
Gianni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top