Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Did you ever...

Did you ever...

Scheduled Pinned Locked Moved The Lounge
debuggingquestion
38 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Star Vega

    Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

    M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #17

    Rarely. The most recent example is a form that can be used for both adding and updating a record, so I put the "Add" and "Update" buttons on top of each other. Changing the text wouldn't have worked, because I'd also have needed to rewire the events. Reading the other comments, I've come to realize that a custom 2 state button would have been better, with separate add/update events and a state flag that, when changed, would change the text and also fire the correct event when the button was clicked. Hmmm.... Marc

    Thyme In The Country Interacx My Blog

    J S 2 Replies Last reply
    0
    • M Marc Clifton

      Rarely. The most recent example is a form that can be used for both adding and updating a record, so I put the "Add" and "Update" buttons on top of each other. Changing the text wouldn't have worked, because I'd also have needed to rewire the events. Reading the other comments, I've come to realize that a custom 2 state button would have been better, with separate add/update events and a state flag that, when changed, would change the text and also fire the correct event when the button was clicked. Hmmm.... Marc

      Thyme In The Country Interacx My Blog

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #18

      Marc Clifton wrote:

      Hmmm....

      Go on Marc! I know you want to! It's just a few lines of code...

      -- Kein Mitleid Für Die Mehrheit

      1 Reply Last reply
      0
      • S Star Vega

        Yep, a good comparison indeed - I'm in the middle of it! Did this 'Monster' experience bring something good for you? Or is it just an enormous waste of time? (I go for the second option)

        R Offline
        R Offline
        Rajesh R Subramanian
        wrote on last edited by
        #19

        Some time was wasted in that, but I wouldn't say it was a total waste. I learned a few goodies by working on that project. But nevertheless, a total nightmare.

        Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

        1 Reply Last reply
        0
        • M Marc Clifton

          Rarely. The most recent example is a form that can be used for both adding and updating a record, so I put the "Add" and "Update" buttons on top of each other. Changing the text wouldn't have worked, because I'd also have needed to rewire the events. Reading the other comments, I've come to realize that a custom 2 state button would have been better, with separate add/update events and a state flag that, when changed, would change the text and also fire the correct event when the button was clicked. Hmmm.... Marc

          Thyme In The Country Interacx My Blog

          S Offline
          S Offline
          Simon P Stevens
          wrote on last edited by
          #20

          Marc Clifton wrote:

          I've come to realize that a custom 2 state button would have been better, with separate add/update events and a state flag that, when changed, would change the text and also fire the correct event when the button was clicked.

          Nice. I like that idea.

          Simon

          1 Reply Last reply
          0
          • S Star Vega

            Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

            R Offline
            R Offline
            Rama Krishna Vavilala
            wrote on last edited by
            #21

            That becomes a maintenance nightmare. Property sheets and tabs are better if there are many controls. Changing control text is another option. If that fails a custom/user control is another option. In short avoid it like plague. I personally will hate to debug such code, because in my first job it was like that and I never liked the job.

            Proud to be a CPHog user

            G 1 Reply Last reply
            0
            • S Star Vega

              Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

              G Offline
              G Offline
              Gary Wheeler
              wrote on last edited by
              #22

              The closest I come to that is having a static control on a dialog as a placeholder for another control (like an ActiveX instantiation) I'm creating dynamically. I get the location of the static, destroy it, and then create the desired 'dynamic' control. I have had dialogs with groups of controls, where only one group of controls was visible at a time. The dialog layout in the resources had nothing to do with the final appearance, as the dialog automatically laid out its child controls. This was a special case, however, where a child dialog or a property page wasn't an appropriate solution.

              Software Zen: delete this;

              1 Reply Last reply
              0
              • S Star Vega

                Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

                J Offline
                J Offline
                Joan M
                wrote on last edited by
                #23

                * Because it is harder to maintain. ==> when you want to select one item you must remove the items above it. * Because it is much better to handle the texts and behaviors programmatically. * Because it is faster to program than to assign properties. It is slow to assign properties to all the controls and if you must do it for several controls it is painfully slow... * Because you are consuming more memory. * Because you must have several handlers for the several items involved. ... Hope this helps... PS: In the PLC world, several times we are using poor displays that have limited options and some times we must make this kind of things, but it is painful to reuse everything, my rule of thumb is: if you have enough horsepower use it, don't rely on bad practices... :rolleyes:

                [www.tamelectromecanica.com][www.tam.cat]

                https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                R 1 Reply Last reply
                0
                • S Star Vega

                  Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

                  S Offline
                  S Offline
                  Simon P Stevens
                  wrote on last edited by
                  #24

                  I've done it for simple cases. (Like Marc's update/add button). But for more than 2 controls, I would use something else. Primary reason for not doing it would be complexity. windows forms is ugly enough anyway, when you start stacking controls on top of each other you can't see what's there, and reading the code to work it out isn't really an option.

                  Simon

                  M 1 Reply Last reply
                  0
                  • R Rama Krishna Vavilala

                    That becomes a maintenance nightmare. Property sheets and tabs are better if there are many controls. Changing control text is another option. If that fails a custom/user control is another option. In short avoid it like plague. I personally will hate to debug such code, because in my first job it was like that and I never liked the job.

                    Proud to be a CPHog user

                    G Offline
                    G Offline
                    Graham Bradshaw
                    wrote on last edited by
                    #25

                    Rama Krishna Vavilala wrote:

                    That becomes a maintenance nightmare.

                    Maybe, but it sounds like you are building the software for you, not for the user. You need to do what is best for the user experience, not what is easiest for the developer. In some cases, dynamically showing/hiding controls in response to user input is the correct thing to do, and the fact that it makes your life as a developer harder is not important.

                    R 1 Reply Last reply
                    0
                    • J Joan M

                      * Because it is harder to maintain. ==> when you want to select one item you must remove the items above it. * Because it is much better to handle the texts and behaviors programmatically. * Because it is faster to program than to assign properties. It is slow to assign properties to all the controls and if you must do it for several controls it is painfully slow... * Because you are consuming more memory. * Because you must have several handlers for the several items involved. ... Hope this helps... PS: In the PLC world, several times we are using poor displays that have limited options and some times we must make this kind of things, but it is painful to reuse everything, my rule of thumb is: if you have enough horsepower use it, don't rely on bad practices... :rolleyes:

                      [www.tamelectromecanica.com][www.tam.cat]

                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #26

                      Very well put pal. :)

                      Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                      M 1 Reply Last reply
                      0
                      • S Simon P Stevens

                        I've done it for simple cases. (Like Marc's update/add button). But for more than 2 controls, I would use something else. Primary reason for not doing it would be complexity. windows forms is ugly enough anyway, when you start stacking controls on top of each other you can't see what's there, and reading the code to work it out isn't really an option.

                        Simon

                        M Offline
                        M Offline
                        Michael Schubert
                        wrote on last edited by
                        #27

                        I work in software localization and part of that is that we have to resize dialog controls to fit the translated text. Dialogs with stacked controls are a frickin' nightmare! Edit: Odd. I was sure I replied to the OP...

                        modified on Tuesday, September 23, 2008 7:36 AM

                        1 Reply Last reply
                        0
                        • R Rajesh R Subramanian

                          Very well put pal. :)

                          Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                          M Offline
                          M Offline
                          Michael Schubert
                          wrote on last edited by
                          #28

                          Isn't Joan a she?

                          R 1 Reply Last reply
                          0
                          • M Michael Schubert

                            Isn't Joan a she?

                            R Offline
                            R Offline
                            Rajesh R Subramanian
                            wrote on last edited by
                            #29

                            There we go. Much better now. :-D

                            Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                            1 Reply Last reply
                            0
                            • G Graham Bradshaw

                              Rama Krishna Vavilala wrote:

                              That becomes a maintenance nightmare.

                              Maybe, but it sounds like you are building the software for you, not for the user. You need to do what is best for the user experience, not what is easiest for the developer. In some cases, dynamically showing/hiding controls in response to user input is the correct thing to do, and the fact that it makes your life as a developer harder is not important.

                              R Offline
                              R Offline
                              Rama Krishna Vavilala
                              wrote on last edited by
                              #30

                              For one or two releases that might work fine. Everyone might be happy. But now a user wants a new feature, he wants more controls. A developer adds more and more controls. The screen becomes such a mess that user cannot get the new feature out from it or in time and budget. If a software product is used once and only once such a practice will be OK, but if a software product has to survive for a long time with customer requests translating into new features in a reasonable time than it is always better to write maintainable code.

                              Graham Bradshaw wrote:

                              You need to do what is best for the user experience, not what is easiest for the developer.

                              These are not orthogonal concepts and no excuse for writing non maintainable code. It is generally always possible to write maintainable code which produces best user experience. In the case of OP there are several such options are available.

                              Proud to be a CPHog user

                              G 1 Reply Last reply
                              0
                              • R Rama Krishna Vavilala

                                For one or two releases that might work fine. Everyone might be happy. But now a user wants a new feature, he wants more controls. A developer adds more and more controls. The screen becomes such a mess that user cannot get the new feature out from it or in time and budget. If a software product is used once and only once such a practice will be OK, but if a software product has to survive for a long time with customer requests translating into new features in a reasonable time than it is always better to write maintainable code.

                                Graham Bradshaw wrote:

                                You need to do what is best for the user experience, not what is easiest for the developer.

                                These are not orthogonal concepts and no excuse for writing non maintainable code. It is generally always possible to write maintainable code which produces best user experience. In the case of OP there are several such options are available.

                                Proud to be a CPHog user

                                G Offline
                                G Offline
                                Graham Bradshaw
                                wrote on last edited by
                                #31

                                Rama Krishna Vavilala wrote:

                                better to write maintainable code.

                                Better than what, exactly?

                                1 Reply Last reply
                                0
                                • S Star Vega

                                  Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

                                  E Offline
                                  E Offline
                                  Ennis Ray Lynch Jr
                                  wrote on last edited by
                                  #32

                                  It is symptomatic of drag and drop based design.

                                  Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
                                  Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
                                  Most of this sig is for Google, not ego.

                                  1 Reply Last reply
                                  0
                                  • R Rajesh R Subramanian

                                    Placing control over control over co... I wouldn't do it, because that is the mark of an asshole.

                                    Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

                                    J Offline
                                    J Offline
                                    Joe Simes
                                    wrote on last edited by
                                    #33

                                    Rajesh R Subramanian wrote:

                                    because that is the mark of an a**hole.

                                    :laugh: Oh if only a real mark existed (like a big black A tattooed on your forehead)!!!

                                    1 Reply Last reply
                                    0
                                    • S Star Vega

                                      Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #34

                                      On one program, but it's a dice game (Cosmic Wimpout), where not all actions are allowed all the time and only showing the currently relevant actions seems like a better design than disabling some and making the player figure out which are available. There are nine buttons in a panel and no more than three are visible at any one time, usually only one or two. On the other hand, they don't completely cover each other in the designer (that would be stupid), they only overlap; when made visible, the code has to decide where to place them as well.

                                      D 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        On one program, but it's a dice game (Cosmic Wimpout), where not all actions are allowed all the time and only showing the currently relevant actions seems like a better design than disabling some and making the player figure out which are available. There are nine buttons in a panel and no more than three are visible at any one time, usually only one or two. On the other hand, they don't completely cover each other in the designer (that would be stupid), they only overlap; when made visible, the code has to decide where to place them as well.

                                        D Offline
                                        D Offline
                                        Dan Neely
                                        wrote on last edited by
                                        #35

                                        If you're doing runtime layout anyway, why have any overlap in the designer at all?

                                        Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

                                        P 1 Reply Last reply
                                        0
                                        • S Star Vega

                                          Did you ever felt the need to put controls on top of each other? So you can set them visible/invisible depending on the situation? This project I have to 'debug' is full of it... You have a button over a textbox over a panel over a groupbox and so on ! The guys here wonder why I do not like this practice. Can you tell me why you wouldn't do this, so I can offer them a LIST of reasons... ;)

                                          D Offline
                                          D Offline
                                          daniilzol
                                          wrote on last edited by
                                          #36

                                          We have it in couple of places because tab control is not pretty enough and users want to use buttons to switch between "tabs". *shrug*

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups