Results 1 to 17 of 17

Thread: Much Oddness

  1. #1

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Much Oddness

    This is conflabulating me.

    ' Make all of the option buttons invisible
    VB Code:
    1. p = Option1.Count
    2. For n = 1 To p
    3.     Option1(n - 1).Visible = False
    4. 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
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  2. #2

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Much Oddness

    Hmm - whan I do this....

    VB Code:
    1. p = Option1.Count
    2. For n = p To 1 Step -1
    3.      Option1(n - 1).Visible = False
    4. 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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    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.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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

  6. #6

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  7. #7

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  9. #9

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Much Oddness

    But the click event is only firing once.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  11. #11

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    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
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  12. #12
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Much Oddness

    Quote 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?

  13. #13

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  14. #14

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Much Oddness

    Quote 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.
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  15. #15
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Much Oddness

    In that case only hide the once you don't need don't hide them all.

  16. #16

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Much Oddness

    True enough. Working on it now...
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  17. #17

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    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.

    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width