| Mirage Source http://miragesource.net/forums/ |
|
| Use OptionButton instead of ComboBox http://miragesource.net/forums/viewtopic.php?f=201&t=3110 |
Page 1 of 2 |
| Author: | Kay-No [ Mon Dec 03, 2007 1:54 pm ] |
| Post subject: | Use OptionButton instead of ComboBox |
Hello, Im pretty new to VB, and im trying to learn it. Im trying to make all the Selection's (like male/female, pick character, Class selection) as pictures instead of those nasty "lists" etc... So my question is: How can i set the Class selection as Option buttons? This is the current one as a ComboBox but i need it in OptionButtons: Code: Private Sub cmbClass_Click()
lblHP.Caption = STR(Class(cmbClass.ListIndex).HP) lblMP.Caption = STR(Class(cmbClass.ListIndex).MP) lblSP.Caption = STR(Class(cmbClass.ListIndex).SP) lblSTR.Caption = STR(Class(cmbClass.ListIndex).STR) lblDEF.Caption = STR(Class(cmbClass.ListIndex).DEF) lblSPEED.Caption = STR(Class(cmbClass.ListIndex).speed) lblMAGI.Caption = STR(Class(cmbClass.ListIndex).MAGI) lblClassDesc.Caption = Class(cmbClass.ListIndex).desc |
|
| Author: | Anthony [ Mon Dec 03, 2007 3:43 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
The way I would do it (although some may argue against it, it may be bad coding practice) is just make the images and when you click the image have it set cmbClass.ListIndex = 0. Or 1 or 2 or whatever. Then hide the combo box off the screen. |
|
| Author: | Kay-No [ Mon Dec 03, 2007 3:53 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
Vegeta wrote: The way I would do it (although some may argue against it, it may be bad coding practice) is just make the images and when you click the image have it set cmbClass.ListIndex = 0. Or 1 or 2 or whatever. Then hide the combo box off the screen. hmmm, ok. |
|
| Author: | Matt [ Mon Dec 03, 2007 4:16 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
Code: If optClass1.value = 1 then cmbclass.listindex = 0 else etc etc That's what Vegeta is talking about. It does everything you need it to do, without seeing the list box and it looking the exact way you asked about. |
|
| Author: | Anthony [ Mon Dec 03, 2007 6:11 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
Oh right |
|
| Author: | Kay-No [ Mon Dec 03, 2007 6:53 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
Vegeta wrote: The way I would do it (although some may argue against it, it may be bad coding practice) is just make the images and when you click the image have it set cmbClass.ListIndex = 0. Or 1 or 2 or whatever. Then hide the combo box off the screen. Dunno if its right but, i made three new Option Buttons.... Code: Private Sub Option1_Click() cmbClass.ListIndex = 0 End Sub Private Sub Option2_Click() cmbClass.ListIndex = 1 End Sub Private Sub Option3_Click() cmbClass.ListIndex = 2 End Sub Im sure its 100% wrong? |
|
| Author: | Beres [ Mon Dec 03, 2007 6:57 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
yeah thats right |
|
| Author: | Kay-No [ Mon Dec 03, 2007 7:02 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
Beres wrote: yeah thats right am i right that its 100% wrong or is it correctly done? If its correct then, whats up with these values? Code: lblHP.Caption = STR(Class(cmbClass.ListIndex).HP)
lblMP.Caption = STR(Class(cmbClass.ListIndex).MP) lblSP.Caption = STR(Class(cmbClass.ListIndex).SP) lblSTR.Caption = STR(Class(cmbClass.ListIndex).STR) lblDEF.Caption = STR(Class(cmbClass.ListIndex).DEF) lblSPEED.Caption = STR(Class(cmbClass.ListIndex).speed) lblMAGI.Caption = STR(Class(cmbClass.ListIndex).MAGI) lblClassDesc.Caption = Class(cmbClass.ListIndex).desc |
|
| Author: | Beres [ Mon Dec 03, 2007 7:04 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
100% you are correct. Those values are assigned by when you click on a class. Since when you click on an option, its just like clicking in the combo box. So it should still assign those values. EDIT: The STR(Class(cmbClass.ListIndex).HP) is basically the class. Lets say the listindex = 0. Thats Class0. It gets the stats from there. |
|
| Author: | William [ Mon Dec 03, 2007 8:55 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
or replace this part Code: cmbClass.ListIndex with a variable, like: Code: STR(Class(iIndex).SP) And set iIndex to whatever char it is you pressed on. |
|
| Author: | Beres [ Mon Dec 03, 2007 9:04 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
William wrote: or replace this part Code: cmbClass.ListIndex with a variable, like: Code: STR(Class(iIndex).SP) And set iIndex to whatever char it is you pressed on. But wouldnt it work just by leaving it as STR(Class(cmbClass.ListIndex).SP) or whatever.? I mean its just like clicking on the cmbClass itself and selecting a class. Except you're just settings its listindex by code.. |
|
| Author: | Lea [ Tue Dec 04, 2007 1:06 am ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
First of all... will the number of classes you use ever change? Second of all... it probably will, and this will be a pain. You could have the form set up at run time to be the correct size, and have the correct number of option buttons, etc. Google documentation on creating form elements at run time. Nextly, I would create a control array, so you would have radiobutton(0), radiobutton(1), radiobutton(2), etc. Create a function called "Update Form" and call that from each radio buttons click event. radiobutton(0) would call UpdateForm(0), where radiobutton(1) would call UpdateForm(1), etc. Have the UpdateForm function update the form based on the values that are sent to you when you open the form. |
|
| Author: | Kay-No [ Tue Dec 04, 2007 10:47 am ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
wow, tought i would be easy... Just to copy the values from the Combox and paste into a Optionbox. But if make the number of classes and i wont change them after that. Would that be easyier? |
|
| Author: | William [ Tue Dec 04, 2007 12:11 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
It's very easy, just doesn't seem like you know the basics. Is suggest you read some tutorials to learn about variables and such. |
|
| Author: | Matt [ Tue Dec 04, 2007 1:30 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
If you have a base set amount of classes, and you're not going to change it anytime soon, it's really simple. Code: private sub optClass1_click() cmbClass.listindex = 0 end sub private sub optClass2_click() cmbClass.listindex = 1 end sub private sub optClass3_click() cmbClass.listindex = 2 end sub Or something along those lines anyways. |
|
| Author: | Beres [ Tue Dec 04, 2007 7:49 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
Perfekt wrote: If you have a base set amount of classes, and you're not going to change it anytime soon, it's really simple. Code: private sub optClass1_click() cmbClass.listindex = 0 end sub private sub optClass2_click() cmbClass.listindex = 1 end sub private sub optClass3_click() cmbClass.listindex = 2 end sub Or something along those lines anyways. He has already said that lol |
|
| Author: | Matt [ Tue Dec 04, 2007 8:01 pm ] |
| Post subject: | Re: Use OptionButton instead of ComboBox |
I know he has. But he then said that he didn't think it would be hard. So I made that post. Pay attention. |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|