MiniGUI - How to set combobox value?

307 views
Skip to first unread message

Raymond

unread,
Mar 13, 2013, 12:07:44 AM3/13/13
to harbou...@googlegroups.com
I am trying to assign a value to a combobox. I can assign a value to a textbox successfully using SetProperty but the same method for the combobox doesn't work.
 SetProperty( thiswindow.name, 'textboxDescr',  'Value',    AccChart->Descr )
 SetProperty( thiswindow.name, 'comboboxAccType','Value',    1 )
The combobox is defined with an array as the value for the items property.
Thanks.
 

Pete

unread,
Mar 13, 2013, 9:26:59 AM3/13/13
to Harbour Users
Raymond,

This is rather wrong group to post MiniGui questions.
You might get better response in these groups:
http://tech.groups.yahoo.com/group/harbourminigui/
http://www.hmgforum.com/

Now, regarding your question: What you mean by 'value'?
In a textbox the 'value' property holds the content of the textbox.
(text).
In a combobox the 'value' property represents the row index of the
currently selected item (numeric) and works as expected.
Changing a combobox value you move the focus pointer to a new row -it
does not change Items.
So, invoking " SetProperty( thiswindow.name,
'comboboxAccType','Value', 1 ) "
you actually change the focus (select) to the first Item.
OTOH, if you intend to change some Item (which i guess is what you're
looking for) then you have to use:
SetProperty ( 'YourFormName' , 'YourComboName', 'Item' , nItem ,
'cChangedItemText' )
where 'Item' is a literal constant and nItem is the index-pointer (IOW
the combo row) of the Item you want to change
(the rest args are self-explanatory..)

---
Pete

Raymond

unread,
Mar 13, 2013, 8:50:35 PM3/13/13
to harbou...@googlegroups.com
Hi Pete,
Thanks for pointing me to the correct groups. I was single minded to seach on google groups only. :)
On the subject: My combobox Items' value is an array & I want to move the array pointer to the correct row & have combobox display the content of the array row. I think my use of SetProperty() to move the pointer is correct but don't understand why the content doesn't display.
 
Thanks.

Raymond

unread,
Mar 13, 2013, 8:54:38 PM3/13/13
to harbou...@googlegroups.com
I have also tried DisplayValue but nothing shows.

Raymond

unread,
Mar 13, 2013, 9:59:32 PM3/13/13
to harbou...@googlegroups.com
I think it's a precedence issue.
 
I declared the array variable as private in the main function, define the main window object with ON INIT calling a procedure which assigns values to the array.
I then defined a Browse object with it's ON CHANGE calling a procedure which reference the array.
Then, the combobox is defined.
 
When the window opens, the combobox comes into being before the window's ON INIT procedure is being called thus an empty array is actually being assigned to the combobox.
 
It explains why moving the statement to assign values to the array from the window's ON INIT to under the main function solved the problem.
But still I don't understand why it doesn't solve the browse ON CHANGE problem with referencing the array, but that's another post.
 
I am putting this forward as a closure to the problem & for the benefit of any newbies like me who faces this kind of "strange" problem.
 
Thanks.
 
Reply all
Reply to author
Forward
0 new messages