Disappearing tool boxes during debugging.....!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Disappearing tool boxes during debugging.....!

  1. #1
    Join Date
    Jun 2012
    Posts
    15

    Disappearing tool boxes during debugging.....!

    I added some labels, combo boxes in the tab control, but as soon as i debug, they seem to vanish. I'm totally confused. What's going on?
    I've attached screenshots.
    Thanks in advance.
    Attached Images Attached Images   

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,583

    Re: Disappearing tool boxes during debugging.....!

    Perhaps it's the simplest possible reason: Something sets their Visible property to false? The fact that they're visible in the Forms Designer screen shot isn't even a sure indication that you didn't make them invisible at design time. They would remain visible in the designer because otherwise it would become tricky (though not impossible) to interact with them while you don't see them; they wouldn't actually become invisible before runtime. At least for label7 this is apparently not the case, though, since the properties window indicates Visible == true.

    It could still be something in your code that hides them at runtime. The properties window shown in the debugging display (first screen shot) isn't reliable at this point: It just shows the design time properties. (In my setup and AFAIR the default this window isn't visible while debugging anyway, since it wouldn't be of much practical use.) Better inspect the live runtime properties of the controls in the debugger's Auto or Locals window. Don't click the pause button in the debuggers tool bar to do that: That way you may catch the program in a state where the debugger cant (easily) access the control variables. Better set a breakpoint in one of your form class' event handlers. The Click handler of one of the buttons that remain visible is a good place for the breakpoint; that way you can see that the controls in question are invisible befor you deliberately trigger the breakpoint by clicking the button. You'll find the controls as members of the this variable.

    Another possibility wold be that they actually are visible but get obscured by the tab control. That could happen if by accident they actually aren't contained in the tab control, but in the form itself. As a quick check for that you can have a look at their Location values: Do they really make sense as specified relative to the tab control's client area or rather to the form? This should be especially easy to see on label7 since it's located pretty close to the tab control's upper edge, so its Location.Y value should be quite small. Unfortunately the screen shots don't show the Location property, otherwise I'd have checked that already. Beyond this, this is somewhat trickier to diagnose, so let's check the simple options first.
    Last edited by Eri523; July 10th, 2012 at 05:31 PM. Reason: Correction regarding the Control::Location property
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Jun 2012
    Posts
    15

    Re: Disappearing tool boxes during debugging.....!

    I haven't added any actual code, as a matter of fact. I was just designing the initial layout of the form. I checked through the design code, also added breakpoints like you mentioned, but i haven't been able to find a solution. I've attached the code, please do have a look, I'm new to the language, maybe that's why i haven't been able to find it yet.
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,583

    Re: Disappearing tool boxes during debugging.....!

    I must admit the .h file you uploaded pretty much confuses me... Just like it should, label7 is contained within the tab page:

    Code:
    this->tabPage1->Controls->Add(this->label7);
    But given that, its coordinates don't really make sense to me:

    Code:
    this->label7->Location = System::Drawing::Point(660, 126);
    According to what I measured on the screen shot you posted, IMO label7->Location.Y rather should be something like 18 instead of 126.

    The only remaining reason for what's going on I currently still can think of is that label7 (and the other controls in question) in z-order is behind its own container control, and I never thought that might even theoretically be possible. Perhaps you can select each one of the offending controls and click on Forms Designer's "To foreground" button? Short of this fixing the problem, can you upload the complete project so I can pick it apart in the debugger? Instructions on how to properly do that can be found in http://forums.codeguru.com/showthrea...01#post2075101.
    Last edited by Eri523; July 10th, 2012 at 06:10 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Jun 2012
    Posts
    15

    Re: Disappearing tool boxes during debugging.....!

    Sorry about that. I might have moved the label around before uploading. The issue isn't really fixed yet. I'm uploading the complete project just like you asked. Thanks a lot for your patience.
    Attached Files Attached Files

  6. #6
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,583

    Re: Disappearing tool boxes during debugging.....!

    That would never have compiled in the state you uploaded it: There was a Click event handler attached to tabPage1 but that handler was neither declared nor defined.

    After fixing that by removing the reference to the non-existent event handler, it compiled and ran perectly fine: The controls on the first tab page were visible (of course only when that tab page was the active one). I tested that with a debug build running both under the control of the debugger and outside, as well as, for completeness, a release build.

    The only explanation I still can come up with now is that you were looking at two different versions of your program: After adding the controls on the tab page in Forms Designer you didn't rebuild your program before running it inside the debugger, so what you were seeing was a version of the program that didn't even have these controls yet. Similar to what I already mentioned in post #2, the Designer's control properties window visible on the debugging screen should would be irrelevant here too, since it represents the state of the Designer and may show a control that doesn't even yet exist in the running program.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  7. #7
    Join Date
    Jun 2012
    Posts
    15

    Re: Disappearing tool boxes during debugging.....!

    Yep. You're absolutely right. I really can't get stupider than this, can i? :P Once i rebuilt my solution, it was working fine. Thanks a lot for your trouble, man.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center