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. General Programming
  3. C / C++ / MFC
  4. Method of flagging a dialog control in error

Method of flagging a dialog control in error

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
18 Posts 5 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 Still learning how to code

    Hi, I want to check that all fields of a dialog are completed correctly by the user and to flag any controls that need attention. The only way that I can see of doing this is to create a transparent read-only edit box next to the dialog control in error. Then if the control needs attention, I can write an asterisk character to the associated edit box. Although this works, it would be more noticeable if the asterisk had a foreground colour other than black (e.g. red). I can't see any way of doing this, or is there a better method of achieving a similar result ? Any suggestions/advice welcomed ! Doug

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #2

    you could display anything you like, e.g. a little red icon, and give it a tooltip showing some explanation when hovered. Have a look here[^] to see what the .NET Framework provides. :)

    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

    S 1 Reply Last reply
    0
    • L Luc Pattyn

      you could display anything you like, e.g. a little red icon, and give it a tooltip showing some explanation when hovered. Have a look here[^] to see what the .NET Framework provides. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      S Offline
      S Offline
      Still learning how to code
      wrote on last edited by
      #3

      Hi Luc, I don't have any experience with .NET or C#. I am using MFC and am wondering if there is anything I can use without involving a steep learning curve. Thanks in advance for your advice. :) Doug

      L 1 Reply Last reply
      0
      • S Still learning how to code

        Hi Luc, I don't have any experience with .NET or C#. I am using MFC and am wondering if there is anything I can use without involving a steep learning curve. Thanks in advance for your advice. :) Doug

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #4

        I'm not saying you need .NET or C#, just suggesting you could show something on your form, like a small icon, and give it a tooltip-like behavior. I'm sure that can be done easily in MFC; I'm not sure I ever knew how though, as I don't use pre-.NET technologies. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        S 1 Reply Last reply
        0
        • S Still learning how to code

          Hi, I want to check that all fields of a dialog are completed correctly by the user and to flag any controls that need attention. The only way that I can see of doing this is to create a transparent read-only edit box next to the dialog control in error. Then if the control needs attention, I can write an asterisk character to the associated edit box. Although this works, it would be more noticeable if the asterisk had a foreground colour other than black (e.g. red). I can't see any way of doing this, or is there a better method of achieving a similar result ? Any suggestions/advice welcomed ! Doug

          C Offline
          C Offline
          Chuck OToole
          wrote on last edited by
          #5

          There's an excellent control XBalloonMsg that can give you a balloon on the field in error. I use it all the time and it's easy to invoke. Find the article here[^] A simple one liner creates a balloon error message.

          CXBalloonMsg::Show("Failed", "Create Failed, Web Site may be Offline, Try again Later", GetDlgItem(IDC_CreateNewBeta)->GetSafeHwnd(), GetSafeHwnd());

          S 2 Replies Last reply
          0
          • L Luc Pattyn

            I'm not saying you need .NET or C#, just suggesting you could show something on your form, like a small icon, and give it a tooltip-like behavior. I'm sure that can be done easily in MFC; I'm not sure I ever knew how though, as I don't use pre-.NET technologies. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            S Offline
            S Offline
            Still learning how to code
            wrote on last edited by
            #6

            No problem, Luc ! I really must devote some time in the future to looking at .NET - it clearly does offer a lot. But at the moment, I still haven't REALLY mastered the basics ! Thanks for your help, nevertheless. Doug

            1 Reply Last reply
            0
            • C Chuck OToole

              There's an excellent control XBalloonMsg that can give you a balloon on the field in error. I use it all the time and it's easy to invoke. Find the article here[^] A simple one liner creates a balloon error message.

              CXBalloonMsg::Show("Failed", "Create Failed, Web Site may be Offline, Try again Later", GetDlgItem(IDC_CreateNewBeta)->GetSafeHwnd(), GetSafeHwnd());

              S Offline
              S Offline
              Still learning how to code
              wrote on last edited by
              #7

              Hi Chuck, Fantastic ! I've just had a quick look, and I think that it is JUST what I'm looking for ! Thank you very much for your help ! Doug

              1 Reply Last reply
              0
              • C Chuck OToole

                There's an excellent control XBalloonMsg that can give you a balloon on the field in error. I use it all the time and it's easy to invoke. Find the article here[^] A simple one liner creates a balloon error message.

                CXBalloonMsg::Show("Failed", "Create Failed, Web Site may be Offline, Try again Later", GetDlgItem(IDC_CreateNewBeta)->GetSafeHwnd(), GetSafeHwnd());

                S Offline
                S Offline
                Still learning how to code
                wrote on last edited by
                #8

                Hi again Chuck, I have downloaded the demo project and tried to compile it. However, I am getting the following errors:- Compiling... XBalloonMsg.cpp d:\programming projects\xballoonmsg\src\xballoonmsg.h(48) : error C2065: 'TTI_INFO' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_CLOSE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_NOFADE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_NOANIMATE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(436) : error C2065: 'TTS_BALLOON' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(480) : error C2065: 'TTM_SETTITLE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(508) : error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned long,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned i nt,unsigned int,unsigned long)' This conversion requires a reinterpret_cast, a C-style cast or function-style cast d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(524) : error C2065: 'WM_MENUCOMMAND' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(524) : error C2051: case expression not constant Error executing cl.exe. A Goggle search points me to MSDN, and I find that defines such as TTS_CLOSE are (supposedly) contained within CommCtrl.h - #including this within the relevant .cpp doesn't resolve the errors. Having found CommCtrl.h there is no mention of TTS_anything. What header file is required and where can I get it ? Thanks for your help Doug

                L L 2 Replies Last reply
                0
                • S Still learning how to code

                  Hi again Chuck, I have downloaded the demo project and tried to compile it. However, I am getting the following errors:- Compiling... XBalloonMsg.cpp d:\programming projects\xballoonmsg\src\xballoonmsg.h(48) : error C2065: 'TTI_INFO' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_CLOSE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_NOFADE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_NOANIMATE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(436) : error C2065: 'TTS_BALLOON' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(480) : error C2065: 'TTM_SETTITLE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(508) : error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned long,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned i nt,unsigned int,unsigned long)' This conversion requires a reinterpret_cast, a C-style cast or function-style cast d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(524) : error C2065: 'WM_MENUCOMMAND' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(524) : error C2051: case expression not constant Error executing cl.exe. A Goggle search points me to MSDN, and I find that defines such as TTS_CLOSE are (supposedly) contained within CommCtrl.h - #including this within the relevant .cpp doesn't resolve the errors. Having found CommCtrl.h there is no mention of TTS_anything. What header file is required and where can I get it ? Thanks for your help Doug

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #9

                  Hi, when you encounter problems, or just have a question, relating to a CodeProject article, the recommended approach is to ask in the forum at the bottom of the article; that way the author himself is getting an e-mail notification and may answer your question (unless he is no longer active in CP at all). It also is wise to read through said forum anyway, as it contains comments and questions from others on the subject. Chances are your problem is already dealt with here[^]. :)

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                  1 Reply Last reply
                  0
                  • S Still learning how to code

                    Hi again Chuck, I have downloaded the demo project and tried to compile it. However, I am getting the following errors:- Compiling... XBalloonMsg.cpp d:\programming projects\xballoonmsg\src\xballoonmsg.h(48) : error C2065: 'TTI_INFO' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_CLOSE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_NOFADE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(433) : error C2065: 'TTS_NOANIMATE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(436) : error C2065: 'TTS_BALLOON' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(480) : error C2065: 'TTM_SETTITLE' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(508) : error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned long,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned i nt,unsigned int,unsigned long)' This conversion requires a reinterpret_cast, a C-style cast or function-style cast d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(524) : error C2065: 'WM_MENUCOMMAND' : undeclared identifier d:\programming projects\xballoonmsg\src\xballoonmsg.cpp(524) : error C2051: case expression not constant Error executing cl.exe. A Goggle search points me to MSDN, and I find that defines such as TTS_CLOSE are (supposedly) contained within CommCtrl.h - #including this within the relevant .cpp doesn't resolve the errors. Having found CommCtrl.h there is no mention of TTS_anything. What header file is required and where can I get it ? Thanks for your help Doug

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    Still learning how to code wrote:

                    What header file is required and where can I get it ?

                    It would really help if you stated what compiler you are using. I suspect that you need to install the Platform SDK or Windows SDK. You should also check the value of your _WIN32_WINNT and _WIN32_IE preprocessor definitions. Best Wishes, -David Delaune

                    S 1 Reply Last reply
                    0
                    • L Lost User

                      Still learning how to code wrote:

                      What header file is required and where can I get it ?

                      It would really help if you stated what compiler you are using. I suspect that you need to install the Platform SDK or Windows SDK. You should also check the value of your _WIN32_WINNT and _WIN32_IE preprocessor definitions. Best Wishes, -David Delaune

                      S Offline
                      S Offline
                      Still learning how to code
                      wrote on last edited by
                      #11

                      Hi David, I am running VC++ Ver 6.0 Having followed Luc's advice (see above), I visited the forum postings associated with the article. Within that there was a posting concerning compile errors similar to mine, and the author stated that it was simply a matter of changing the order of header and library directories to make PSDK at the top. Looking in Tools/Options/Directories, I could not see PSDK listed and therefore believe that this is my problem. So I downloaded Microsoft Platform SDK (R2) which seemed to be supported in my OS, WinXP. Only after the download and install, I see early within the documentation:- Warning You cannot use the libraries from the current Platform SDK with Visual C/C++ 6.0 because the libraries were compiled using the new /GS switch to enable buffer overrun detection code. Using libraries compiled with this switch with Visual C/C++ 6.0 results in link errors. Specifically, the linker reports that it cannot find __security_cookie or __security_check_cookie. I guess that the webpage must have specified this somewhere but I must have missed it. Any idea how I get to the right version ? Thanks for your help ! Doug Edit: XP SP3 by the way !!

                      L 1 Reply Last reply
                      0
                      • S Still learning how to code

                        Hi David, I am running VC++ Ver 6.0 Having followed Luc's advice (see above), I visited the forum postings associated with the article. Within that there was a posting concerning compile errors similar to mine, and the author stated that it was simply a matter of changing the order of header and library directories to make PSDK at the top. Looking in Tools/Options/Directories, I could not see PSDK listed and therefore believe that this is my problem. So I downloaded Microsoft Platform SDK (R2) which seemed to be supported in my OS, WinXP. Only after the download and install, I see early within the documentation:- Warning You cannot use the libraries from the current Platform SDK with Visual C/C++ 6.0 because the libraries were compiled using the new /GS switch to enable buffer overrun detection code. Using libraries compiled with this switch with Visual C/C++ 6.0 results in link errors. Specifically, the linker reports that it cannot find __security_cookie or __security_check_cookie. I guess that the webpage must have specified this somewhere but I must have missed it. Any idea how I get to the right version ? Thanks for your help ! Doug Edit: XP SP3 by the way !!

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        Still learning how to code wrote:

                        I am running VC++ Ver 6.0

                        I suspected that would be the case. I am also still using VC6 for maintaining my older projects. The Febuary 2003 Platform SDK was the last version compatible with VC6. I would not recommend attempting to use a later version. *edit* It actually looks like Microsoft removed them from the public download center according to Sheng Jiang. Here is a Microsoft forum post on the subject: http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/83205c43-ef46-447d-ae54-92bbeb543c38[^] Get it while you can... Best Wishes, -David Delaune

                        modified on Sunday, November 28, 2010 5:32 PM

                        S 1 Reply Last reply
                        0
                        • L Lost User

                          Still learning how to code wrote:

                          I am running VC++ Ver 6.0

                          I suspected that would be the case. I am also still using VC6 for maintaining my older projects. The Febuary 2003 Platform SDK was the last version compatible with VC6. I would not recommend attempting to use a later version. *edit* It actually looks like Microsoft removed them from the public download center according to Sheng Jiang. Here is a Microsoft forum post on the subject: http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/83205c43-ef46-447d-ae54-92bbeb543c38[^] Get it while you can... Best Wishes, -David Delaune

                          modified on Sunday, November 28, 2010 5:32 PM

                          S Offline
                          S Offline
                          Still learning how to code
                          wrote on last edited by
                          #13

                          Hi David, I saw somewhere on the web that the last PSDK compatible with VC6 was "the February 2003 version". This is surely the version prior to R2 (as the latter is a problem for VC6) isn't it ? I think that it also said the Feb 2003 version wasn't available from MS on the web ! So where can I get it ? Doug

                          L 1 Reply Last reply
                          0
                          • S Still learning how to code

                            Hi David, I saw somewhere on the web that the last PSDK compatible with VC6 was "the February 2003 version". This is surely the version prior to R2 (as the latter is a problem for VC6) isn't it ? I think that it also said the Feb 2003 version wasn't available from MS on the web ! So where can I get it ? Doug

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #14

                            Whoops, sorry about that... looks like I linked to the wrong SDK. One sec, I'll edit the post and fix it. *edit* I could not find the febuary 2003 version at the public Microsoft download center. However I did find some direct links in the Microsoft forums. You should get it while its still available... You should probably get the SP6 as well if you don't already have it installed. Visual Studio 6 Service Pack 6[^] Best Wishes, -David Delaune

                            modified on Sunday, November 28, 2010 5:39 PM

                            1 Reply Last reply
                            0
                            • S Still learning how to code

                              Hi, I want to check that all fields of a dialog are completed correctly by the user and to flag any controls that need attention. The only way that I can see of doing this is to create a transparent read-only edit box next to the dialog control in error. Then if the control needs attention, I can write an asterisk character to the associated edit box. Although this works, it would be more noticeable if the asterisk had a foreground colour other than black (e.g. red). I can't see any way of doing this, or is there a better method of achieving a similar result ? Any suggestions/advice welcomed ! Doug

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #15

                              Still learning how to code wrote:

                              Then if the control needs attention, I can write an asterisk character to the associated edit box. Although this works, it would be more noticeable if the asterisk had a foreground colour other than black (e.g. red).

                              See here.

                              "One man's wage rise is another man's price increase." - Harold Wilson

                              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                              "Man who follows car will be exhausted." - Confucius

                              S 1 Reply Last reply
                              0
                              • D David Crow

                                Still learning how to code wrote:

                                Then if the control needs attention, I can write an asterisk character to the associated edit box. Although this works, it would be more noticeable if the asterisk had a foreground colour other than black (e.g. red).

                                See here.

                                "One man's wage rise is another man's price increase." - Harold Wilson

                                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                "Man who follows car will be exhausted." - Confucius

                                S Offline
                                S Offline
                                Still learning how to code
                                wrote on last edited by
                                #16

                                Hi David, Thanks very much for bringing this to my attention - looks very interesting and useful article. Why didn't I think of changing the background colour of the control rather than the foreground (retorical question !). It does raise my original point though - why CAN't you change the foreground colour (or have I missed it ?) ? Doug

                                D 1 Reply Last reply
                                0
                                • S Still learning how to code

                                  Hi David, Thanks very much for bringing this to my attention - looks very interesting and useful article. Why didn't I think of changing the background colour of the control rather than the foreground (retorical question !). It does raise my original point though - why CAN't you change the foreground colour (or have I missed it ?) ? Doug

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #17

                                  Still learning how to code wrote:

                                  It does raise my original point though - why CAN't you change the foreground colour (or have I missed it ?) ?

                                  Call SetTextColor() instead of SetBkColor().

                                  "One man's wage rise is another man's price increase." - Harold Wilson

                                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                  "Man who follows car will be exhausted." - Confucius

                                  S 1 Reply Last reply
                                  0
                                  • D David Crow

                                    Still learning how to code wrote:

                                    It does raise my original point though - why CAN't you change the foreground colour (or have I missed it ?) ?

                                    Call SetTextColor() instead of SetBkColor().

                                    "One man's wage rise is another man's price increase." - Harold Wilson

                                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                    "Man who follows car will be exhausted." - Confucius

                                    S Offline
                                    S Offline
                                    Still learning how to code
                                    wrote on last edited by
                                    #18

                                    Of course ! (Just going though the code now, and beginning to see how to about this) Thanks for your help ! Doug

                                    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