ComboBox

ruichaves

30-08-2007 05:06:18

How to get the text of an item selected, using ComboBox??

kungfoomasta

30-08-2007 05:36:55

ComboBox inherits from Label class, and the text is gotten via ComboBox::getCaption. Could you please invest some effort before asking these questions? Intellisense is your friend. :wink:

ruichaves

30-08-2007 14:27:00

No! I have looked up into intellisense always.. but i'm doing with the wrong way..

I'm doing this:

mComboServerList->getDropDownList()->getListItem(0)->getCaption()

Now it's ok... Thanks for the help!

But i think is confuse, why do not put a metod like getSelectedItem() ?!? 8)

kungfoomasta

30-08-2007 15:41:10

getSelectedItem sounds like a good idea, I'm tempted to implement it. If I get time I will add this for next release.

ruichaves

30-08-2007 17:15:47

8)

ruichaves

31-08-2007 04:08:57

Hi!

Maybe a problem with combobox, in function clearlist().

If some item is selected, when called clearlist(), that doesn't remove the item that is selected! "

i need to put:

combobox->setCaption("");

To remove the info of the first item...

Tell me if i'm correct!?

:)

kungfoomasta

31-08-2007 04:36:57

Thanks for pointing this out! I have fixed it in the SVN. The fix is just as you pointed out, setting the caption to "". When/if I implement using a ListItem instead of just the caption, I'll need to remember to change this.

ruichaves

31-08-2007 04:41:16

Ok! Great! :D

Qbound

21-09-2007 15:04:51

another question on CBs.
what EVENT is responsible for the selection of a list item?

i want to register an event on the list that if the user selctes an item i recognize it and can react on this?

cu
qbound

kungfoomasta

21-09-2007 16:54:34

I think I made a function for ComboBox: addOnSelectionEventHandler.
Don't have access to code, but I'm pretty sure it's there.

huaner

30-09-2007 03:01:21

I think I made a function for ComboBox: addOnSelectionEventHandler.
Don't have access to code, but I'm pretty sure it's there.

hi, i have asked this question long before. but if using new version, i found there is also not a scroll bar belong to a combox. so, if i want to add
a scroll bar, how to do it?

kungfoomasta

30-09-2007 08:14:14

Hey Huaner. I didn't test ScrollBar's with ListBox, I'm currently working on it now. Sorry for the wait.. Scrolling isn't so easy to implement, and the ScrollBar's are giving me problems, especially with the amount of customization I want to allow with them.

I will update the SVN thread when I have completed the Scroll components. I thought I'd finish them this weekend, but now it's looking more like Tuesday/Wednesday. Sorry again for the delay. :(

huaner

03-10-2007 01:30:26

Hey Huaner. I didn't test ScrollBar's with ListBox, I'm currently working on it now. Sorry for the wait.. Scrolling isn't so easy to implement, and the ScrollBar's are giving me problems, especially with the amount of customization I want to allow with them.

I will update the SVN thread when I have completed the Scroll components. I thought I'd finish them this weekend, but now it's looking more like Tuesday/Wednesday. Sorry again for the delay. :(

oh, it doesn't matter. In fact, we all must thank you. :D

kungfoomasta

04-10-2007 18:55:05

I've decided to revamp Menu's Lists, and the ComboBox, so I will need some more time before Scrolling works with the ComboBox. I think everybody will like these new changes. :)

mr.Zog

28-10-2007 18:53:32

Sorry for bringing this thread up, but I didn't want to create a new one ;)

Is it possible that ComboBox::getSelectedItem() returns a NULL pointer if I want to get it when first selecting an item and then pressing on a button?

I think the reason is:

ComboBox::onMouseLeaves(const EventArgs& args)
{
mHighlightPanel->setVisible(false);
mHighlightedItem = NULL;
.
.
.
}


So maybe there should be a mActiveItem or something like that?

kungfoomasta

28-10-2007 23:36:08

I reviewed my code, and realized it was a bad way of recording the selected item. I've changed it now, I'll commit to SVN and re-upload the zip for everybody to use.

Thanks for pointing this out!

NickM

29-10-2007 19:16:38

I think I made a function for ComboBox: addOnSelectionEventHandler.
Don't have access to code, but I'm pretty sure it's there.

Has anyone got an example of exactly how this is used, I need to use it but being a bit silly I cant seem to get it working. I get various errors, when I try different things.

Thanks in advance.

Zini

29-10-2007 19:37:10


class foo
{
public:

foo()
{
// ... some stuff

combo_box -> addOnSelectionEventHandler (&foo::handlerFunction, this);

}

void handlerFunction (const QuickGUI::EventArgs&);

};


Edit: misplaced QuickGUI::

kungfoomasta

29-10-2007 19:43:32

I have had another user have a problem with the ComboBox, I may have been hasty in updating the code last night. Tonight I will make a small test in the QGUI demo app to verify all parts work correctly:

Selection (get/set/mouse clicking items)
Highlighting
Clearing Selection

Not really related to your problem, but thought I'd give a heads up with ComboBox anyway.

Zini's example works, here is another:

// Note that "this" is the object used to call the function. It should be
// an instance of Class myClass.
myComboBox->addOnSelectionEventHandler (&myClass::myFunction,this);

void myClass::myFunction(const EventArgs& args)
{
...
}

NickM

29-10-2007 22:22:04

Many thanks to both of you, I was missing out the...

,this

on the end :oops: