Announcement

Collapse
No announcement yet.

Buttons disappear in Windows XP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Buttons disappear in Windows XP

    I am working on a program originally compiled on a Windows98 PC.
    I transferred the source code on a PC with Windows XP and recompiled it.
    I found that in several dialogs many buttons were not visible at all.
    I solved the problem in two ways:
    1) I put the line #OPTION VERSION3
    2) I removed the style %WS_BORDER in the CONTROL ADD BUTTON statement
    I ask if somebody knows the reason of this behavior.
    I attach a zip file with the source code of a 3 test programs that contains the part of the code that creates the dialog.
    The file "prova_pulsanti.bas" is the original code
    The file "prova_pulsanti_VERSION3" has the #OPTION VERSION3 line
    The file "prova_pulsanti_no%WS_BORDER" has all the style %WS_BORDER removed.
    The image files show the resulting dialogs.
    Thanks in advanced and best regards.
    Vincenzo Varoli
    Attached Files

    #2
    i've had similar sort of reactions when changing colors under the WS_COLORSTATIC. That is, under XP it doesnt look
    the same as under Win98/ME.

    That's why you need to test under different versions to be sure you are getting what you intend.

    You can usually work out the differences, sometimes as simply
    as a change in style settings like you suggest.
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

    Comment


      #3
      Vincenzo, is it possible that you are putting the %WS_BORDER style in the position reserved for an EXTENDED style?

      Comment


        #4
        Buttons disappear in windows XP

        No. I am sure that the style is in the rigth place.
        Regards
        Vincenzo Varoli

        Comment


          #5
          Code:
          CONTROL ADD BUTTON,finYOKOGAWA,%IDC_BOTTONEYOKOGAWAESTERNO2,"ES&TERNO2" _
                 ,205,130,61,15, ,%WS_BORDER,CALL YOKOGAWACICLI_Callback() '%WS_BORDER
                 CONTROL ADD BUTTON,finYOKOGAWA,%IDC_BOTTONEYOKOGAWACOSTANTE,"&COSTANTE" _
                 ,270,130,61,15,%WS_BORDER,CALL YOKOGAWACICLI_Callback() '%WS_BORDER
                 CONTROL ADD BUTTON,finYOKOGAWA,%IDC_BOTTONEYOKOGAWAHELP,"&HELP" _
                 ,295,5,40,15, ,%WS_BORDER,CALL PARAMETRIHELP_Callback() '%WS_BORDER
                 CONTROL ADD BUTTON,finYOKOGAWA,%IDC_BOTTONEYOKOGAWADISATTIVA,"&DISATTIVA" _
                 ,295,25,40,15, ,%WS_BORDER ',CALL PARAMETRIDISATTIVA_Callback()
          CONTROL ADD BUTTON [ or anything] ..
          ...
          Custom style values replace the default values. That is, they are not additional to the default style values - your code must specify all necessary primary and extended style parameters.
          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


            #6
            BTW... save yourself some work when creating a lot of controls of the same style

            Code:
            %BUTTON_STYLE =  %WS_CHILD OR %WS_VISIBLE OR %WS_GROUP OR %WS_TABSTOP
            
            ...
            CONTROL ADD BUTTON,finYOKOGAWA,% IDC_BOTTONEYOKOGAWADISATTIVA,"&DISATTIVA" _
                   ,295,25,40,15, ,%BUTTON_STYLE  ',CALL PARAMETRIDISATTIVA_Callback()
            Lots easier to play with styles if you code it like this.

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


              #7
              Windows/98 was no doubt more 'forgiving' about styles than Windows/XP.

              (I did the same kind of thing a while ago ... Windows 98 forgave, Windows/XP did not and presto "no buttons on my screen when run on XP but they were fine on Win/98")

              For what it's worth, your windows may actually be created, but because they don't have style WS_VISIBLE, they are not, well, visible.
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


                #8
                I found the error.
                The style was in the wrong place as Chris Holbrook suggested.
                I do not know how with Win98 the program was OK
                Thanks to all
                Regards
                Vincenzo Varoli

                Comment


                  #9
                  I found the error.
                  The style was in the wrong place as Chris Holbrook suggested.
                  I was looking at this again this AM ....


                  If that was all you changed.... moving the parameter position of WS_BORDER in the CONTROL ADD statement... that should NOT have fixed the problem, as the control would not have the WS_VISIBLE style. You sure you didn't add WS_VISIBLE and WS_CHILD into the style?

                  I do not know how with Win98 the program was OK
                  This one I know; been there, done that. Windows/98 "forgave" some errors, but Windows/XP does not. Each new release of Windows has 'tightened up' enforcement of the documented rules.

                  MCM
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                    #10
                    Originally posted by Michael Mattias View Post
                    that should NOT have fixed the problem, as the control would not have the WS_VISIBLE style. You sure you didn't add WS_VISIBLE and WS_CHILD into the style?
                    Not for DDT. This is default button creation code from PBForms:
                    Code:
                        dialog new hParent, "Dialog1", 70, 70, 201, 121, to hDlg
                        control add button, hDlg, %IDC_BUTTON1, "Button1", 60, 35, 52, 35

                    Comment


                      #11
                      Now the program is OK.
                      Thanks again to all.
                      Regards
                      Vincenzo Varoli

                      Comment


                        #12
                        >Not for DDT. This is default button creation code from PBForms

                        See quote from helpfile above in Post #5. If he put WS_BORDER (all by itself) in as an explicit "style" parameter in the CONTROL ADD BUTTON statement, that control should not be visbile.

                        MCM
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                          #13
                          Note that DDT always gives your controls certain styles, such as %WS_CHILD and %WS_VISIBLE, regardless of the styles you specify. When setting your style parameter, you can safely ignore these two styles and concentrate on the more important styles that are required. This has the advantage of reducing the clutter of your code. The exception is custom controls - in this case you must explicitly specify all required styles.
                          From the PBWin Help File Control Styles topic.
                          Sincerely,

                          Steve Rossell
                          PowerBASIC Staff

                          Comment


                            #14
                            Note that DDT always gives your controls certain styles, such as %WS_CHILD and %WS_VISIBLE

                            Custom style values replace the default values. That is, they are not additional to the default style values -
                            I guess no Pulitzer Prize for the documentation team this year, huh?
                            Michael Mattias
                            Tal Systems (retired)
                            Port Washington WI USA
                            [email protected]
                            http://www.talsystems.com

                            Comment


                              #15
                              Originally posted by Michael Mattias View Post
                              See quote from helpfile above in Post #5. If he put WS_BORDER (all by itself) in as an explicit "style" parameter in the CONTROL ADD BUTTON statement, that control should not be visbile.
                              but he put it in as an extended style not as a style. %WS_BORDER = &H00800000 which becomes %WS_EX_NOACTIVATE when moved into the next parameter position, accounting for the behaviour observed.

                              If you mean that the documentation is misleading, you could be right - I haven't looked very closely at it because it would drive me mad. Madder. However, Vincenzo made the intelligent choice and compiled with the compiler, not the help file!

                              Comment


                                #16
                                >Vincenzo made the intelligent choice and compiled with the compiler, not the help file

                                A certain high-ranking PowerBASIC Inc. executive once posted in a news group that the help files are an integral component of the compiler product, with which comment I agreed and posted such myself.

                                it was a long time ago, but I could probably find the exact quote here somewhere. It was in response to someone who wanted to package the PB help files with HIS product.
                                Michael Mattias
                                Tal Systems (retired)
                                Port Washington WI USA
                                [email protected]
                                http://www.talsystems.com

                                Comment

                                Working...
                                X
                                😀
                                🥰
                                🤢
                                😎
                                😡
                                👍
                                👎