PDA

View Full Version : Combobox's and setVisibile(false)



celestian
October 9th, 2017, 05:18
I started using a couple combo boxes for selections that just don't make sense in a cycler and noticed that setVisible() doesn't seem to work entirely on them.

The way I've set things up is the player can use a cycler to select a "type" that type hides/shows specific options to select. Some of those options are comboboxes, some aren't.

When setting those combos to setVisibile(false) you'll still see the pull down for the box as a tiny sliver (you can't actually see the items when you click it but just a long line down).

Is there some trick to getting the combo boxes to actually hide every piece?

Here is what I'm seeing. This section has no drop downs, just cyclers.

https://i.imgur.com/tONonGo.png

When you click on the pull down this is how it looks (note the scroll bar now also).

https://i.imgur.com/z0O42ji.png

Nickademus
October 9th, 2017, 08:06
I worked with comboboxes recently; I actually rewrote the code to make a visually different one that functioned slightly differently. But if I remember correctly, there are two controls, well three technically. The combobox entry, the button, and the window that is created. The window is made progmatically and stored as a variable in the combobox control. I removed the button on my version, but I think it is also a control made in the combobox code and stored in a variable. Check the generic lua files for a variable at the top that would hold the control and try to add a setVisible(false) for that control as well.

celestian
October 9th, 2017, 17:27
I worked with comboboxes recently; I actually rewrote the code to make a visually different one that functioned slightly differently. But if I remember correctly, there are two controls, well three technically. The combobox entry, the button, and the window that is created. The window is made progmatically and stored as a variable in the combobox control. I removed the button on my version, but I think it is also a control made in the combobox code and stored in a variable. Check the generic lua files for a variable at the top that would hold the control and try to add a setVisible(false) for that control as well.

Crap, yeah I had to add a new "setCustomVisibility()" to replace setVisible() that actually worked. It would hide/show the ctrlButton as it was suppose to then.

This seems more like a bug in the combobox template/code.



function setCustomVisibility(bVisible)

self.setVisible(bVisible);

if ctrlList then
ctrlList.setVisible(bVisible);
end
if ctrlButton then
ctrlButton.setVisible(bVisible);
end
end

Ikael
October 9th, 2017, 22:20
There is function "setComponentVisibility" or "setComboboxVisibility" or something like that (check CoreRPG codes) which will hide combobox controls.

celestian
October 9th, 2017, 22:28
I skimmed right over that, blind!

setComboBoxVisible() is the one that works, thanks for the tip! Saves me having to replace it with another ;)

Moon Wizard
October 9th, 2017, 22:28
Since, the combo box is a generic control template that manages multiple fields and the API doesn't have callbacks for visibility and read only state changes, there are two special functions within the combo box template to handle these.

setComboBoxReadOnly(bool)
setComboBoxVisible(bool)

Cheers,
JPG