|
-
Mar 17th, 2005, 02:36 PM
#1
Thread Starter
Frenzied Member
Much Oddness
This is conflabulating me.
' Make all of the option buttons invisible
VB Code:
p = Option1.Count
For n = 1 To p
Option1(n - 1).Visible = False
Next n
Later in the code, only the option buttons I need are made visible.
My count is three. When I click on option button 1 at full speed, option buttons two and three select, in sequence - but I only want button 1 to select.
The odd thing is.... if I put a debug in the code on ANY of the above lines, thereby halting the code, when I continue with an F5 - the code works???? That is to say. Option button1 and ONLY option button 1 is clicked and remains selected.
Any idea's on this one chaps?
TIA
-
Mar 17th, 2005, 02:39 PM
#2
Thread Starter
Frenzied Member
Re: Much Oddness
Hmm - whan I do this....
VB Code:
p = Option1.Count
For n = p To 1 Step -1
Option1(n - 1).Visible = False
Next n
The reverse happens and three, then two , then one are clicked - when only the one I clicked needs to have been selected.
I think I will reboot.
-
Mar 17th, 2005, 02:47 PM
#3
Re: Much Oddness
You need to show the rest of your code. You are telling us 1 thing, but showing code for something else entirely and its not jiving with your explanation.
-
Mar 17th, 2005, 02:53 PM
#4
Thread Starter
Frenzied Member
Re: Much Oddness
Yes - something doesn't jive here. I will try and put something together. It's difficult as the operation for the buttons is over 4 seperate code area's.
-
Mar 17th, 2005, 03:03 PM
#5
Re: Much Oddness
Are you saying that you click a option, and then the other buttons appear?
Or that you show 3 buttons, but more show. I don't understand
-
Mar 17th, 2005, 03:08 PM
#6
Thread Starter
Frenzied Member
Re: Much Oddness
Ratherthan waste anyones time here I will put a stand alone project together to see if I can reproduce the effect from scratch then I will post it.
-
Mar 17th, 2005, 04:01 PM
#7
Thread Starter
Frenzied Member
Re: Much Oddness
Here we go. If you comment out the line I have indicated, the Option buttons work as they should. With the line back in all buttons fire on a single click - or so it apears - which is most undesirable.
As you can tell from the code I want to dynamically load these buttons at runtime.
Excuse the longwinded nature of the functionality. This code has been cut down out of a more distributed application. I have left the distributed function calls in place to get the functionality as close to that of my main app as possible.
On a final note - the option buttons NEED to be in the picture box container as they co-exist with a graph and I want to be using the pictureBox's co-ordinate system.
Hope all is clear.
This is indeed an odd one.
' Code Removed '
Last edited by David.Poundall; Mar 17th, 2005 at 05:10 PM.
-
Mar 17th, 2005, 04:32 PM
#8
Re: Much Oddness
An an option button in a group is selected and becomes invisible the next button in the same group will automatically gets selected. I don't understand why you need to hide each option button, but if you do you need to remember the index of the selected item and reselect it when the code finish. In your case you'll get into a loop since you use the Click event to call the sub that sets the visible property to false, which can select another item that causes the Click event to fire.... and so on.
-
Mar 17th, 2005, 04:33 PM
#9
Thread Starter
Frenzied Member
Re: Much Oddness
But the click event is only firing once.
-
Mar 17th, 2005, 04:34 PM
#10
Re: Much Oddness
You cannot have more than one option button selected at a time, and they are sequencing down. The last one selected it the last one showing. Maybe you should use checkboxes, as you can select more than one at a time.
I click the second option, and it switches to 2,4,6,8 and won't switch back to none. I hope you have that part figured out.
-
Mar 17th, 2005, 04:36 PM
#11
Thread Starter
Frenzied Member
Re: Much Oddness
Actually - not true. It does fire more than once. I can see it in the small project. When I looked for it in my main App I only saw it trip once.
Great - that gives me something to work on.
Thanks Joacim
-
Mar 17th, 2005, 04:37 PM
#12
Re: Much Oddness
 Originally Posted by David.Poundall
But the click event is only firing once.
What I meant was that if you store the index of the button you select and restore the value afterwards you'll get into a loop. Why do you need to hide the option buttons when one is selected?
-
Mar 17th, 2005, 04:37 PM
#13
Thread Starter
Frenzied Member
Re: Much Oddness
I click the second option, and it switches to 2,4,6,8 and won't switch back to none. I hope you have that part figured out.
Yes I have thanks. That is just a dropo off from translating it across to the smaller project.
-
Mar 17th, 2005, 04:44 PM
#14
Thread Starter
Frenzied Member
Re: Much Oddness
 Originally Posted by Joacim Andersson
What I meant was that if you store the index of the button you select and restore the value afterwards you'll get into a loop. Why do you need to hide the option buttons when one is selected?
That is a bug in my trial project Joacim.
Some background. The buttons are added when my graph form first fires. The graph works in conjunction with a grid. My user selects a column on my grid at random. Some columns when selected require more option buttons, and some require less.
I can create more buttons when I need them but I only make them invisible when I don't need them.
The fixed value of 5 in my project will be variable in the live App.
-
Mar 17th, 2005, 04:47 PM
#15
Re: Much Oddness
In that case only hide the once you don't need don't hide them all.
-
Mar 17th, 2005, 04:49 PM
#16
Thread Starter
Frenzied Member
Re: Much Oddness
True enough. Working on it now...
-
Mar 17th, 2005, 05:07 PM
#17
Thread Starter
Frenzied Member
Re: Much Oddness
Sooooooo with a stand alone options button (you can tell I use them all the time) a single click event occurs when you toggle one of the buttons on or off. When thay are ganged together, for your sins, you get two clicks for the price of one ???
That doesn't stack up with what I am finding. However, I can see the circular argument being caused in the code when I try to make the complete block invisible.
If I just make the extra buttons I don't need invisible after I have run the click event, all is well. So that's that.
At times I could swing for M$ I really could. I'll bet the controls that they use on their apps had this cockeyed functionality eradicated in 1991.
Thanks Joacim , thanks dglienna. Another one bites the dust, and this time it was nearly me. What a waste of time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|