Announcement

Collapse
No announcement yet.

Left-aligned Checkbox

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

  • Left-aligned Checkbox

    How does one get a checkbox to use left-aligned caption text using DDT?
    I'm specifying %BS_LEFT in the CONTROL ADD CHECKBOX statement but it still
    shows up right-aligned.

    A forum search found 2 topics about this, but no resolution or workaround.

    Any ideas?


    ------------------
    Mark Newman
    Mark Newman

  • #2
    Actually, %BS_LEFT specifies the alignment of the text within the text frame (this is the default/normal style).

    %BS_LEFTTEXT is the style that should give you the checkbox on the right side. If you use %BS_RIGHT, then the text will be right-aligned in the text frame. SO combining %BS_LEFTTEXT and %BS_RIGHT should give you a checkbox with the check on the right with the text right-aligned on the left (!). Clear as mud?

    However, if %BS_LEFTTEXT does not work, try using the _extended_ style %WS_EX_RIGHT in it's place.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thanks for the info Lance, though %BS_LEFTTEXT didn't help. Here's my code:
      Code:
      Control Add Checkbox, hDlg, %CHKSAVEFILES, "Save Files", 265, 50, 60, 14, %WS_TABSTOP Or %WS_GROUP Or %BS_LEFTTEXT
      The Help file entry for ADD CHECKBOX should be clarified, as it states:

      %BS_LEFT Places the text on the left side of the control.

      Perhaps adding %BS_LEFTTEXT would also help a bit.



      ------------------
      Mark Newman
      Mark Newman

      Comment


      • #4
        Yes, this has already been scheduled for correction in the next update to the help file, and added to the Errata listings for the current documentation.

        Did %WS_EX_RIGHT work for you?

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Mark,
          As a workaround try:

          Code:
          Control Add Button, hDlg, %CHKSAVEFILES, "Save Files", 265, 50, 60, 14, %BS_AUTOCHECKBOX OR %WS_TABSTOP Or %WS_GROUP Or %BS_LEFTTEXT
          In some cases PB/DLL DDT doesn't pass your style to Windows unless you use the 'native' control type (Button in this case)
          CheckBox, Option and Frame are actually styles of button.

          This has been aired on this forum before, but I don't know if its been picked up by tech support.
          (It took me many hours to solve this problem.)

          Regards, Simon

          [This message has been edited by Simon Morgan (edited June 15, 2001).]

          Comment


          • #6
            Lance - I checked the FAQ forum and didn't see anything there about
            style bits; I must have missed it.

            Using the extended style %WS_EX_RIGHT didn't help.

            Simon - I tried your suggestion but didn't have any luck. Thanks just
            the same!



            ------------------
            Mark Newman
            Mark Newman

            Comment


            • #7
              I just double checked my code in Winlog, from 4.31 to 5.0 t his works and puts the text at a left alignment (Right next to the checkbox)
              Code:
                  Control Add Frame, oDlg, 1, "Configuration", 10,25,225,65
                  Control Add CheckBox, oDlg, %IDCHKBOX1, "Record Log At System Startup (Default = On)",15,35,200,10
                  Control Add CheckBox, oDlg, %IDCHKBOX2, "Show Splash Screen At System Startup",15,45,200,10
                  Control Add CheckBox, oDlg, %IDCHKBOX3, "Show Splash Screen at Application Startup",15,55,200,10
                  Control Add CheckBox, oDlg, %IDCHKBOX4, "Prompt to Clear Log",15,65,120,10
                  Control Add CheckBox, oDlg, %IDCHKBOX5, "Display log in reverse order (Last boot-up first)",15,75,160,10

              '
              '
              Produces:



              Scott



              [This message has been edited by Scott Turchin (edited June 15, 2001).]
              Scott Turchin
              MCSE, MCP+I
              http://www.tngbbs.com
              ----------------------
              True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

              Comment


              • #8
                Why didn't the image take? It said UBB was on...hmmm





                Scott

                ------------------
                Scott
                Scott Turchin
                MCSE, MCP+I
                http://www.tngbbs.com
                ----------------------
                True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

                Comment


                • #9
                  The IMG tag is switched off in this forum... it is mentioned in the small frame to the left of the reply edit box.


                  ------------------
                  Lance
                  PowerBASIC Support
                  mailto:[email protected][email protected]</A>
                  Lance
                  mailto:[email protected]

                  Comment


                  • #10
                    Mark, I suspect you placed the %WS_EX_RIGHT style in the normal style field... if you place it in the extended style field, it should work fine (it produces the same effect as %BS_LEFTTEXT OR %BS_RIGHT are supposed to provide), thus:

                    CONTROL ADD CHECKBOX, hDlg, 202, "Test CheckBox", 0, 0, 50, 10,,%WS_EX_RIGHT

                    Produces a control that looks like this:
                    Code:
                    +---------------------------+
                    |         Test CheckBox [X] |
                    +---------------------------+
                    ------------------
                    Lance
                    PowerBASIC Support
                    mailto:[email protected][email protected]</A>
                    Lance
                    mailto:[email protected]

                    Comment


                    • #11
                      Lance, ahh, much better now! But why? The Help file states that %WS_EX_RIGHT only has
                      an effect for Hebrew or Arabic languages that read right-to-left. How does this work
                      in this case?

                      In any case, my thanks to all who replied!


                      ------------------
                      Mark Newman
                      Mark Newman

                      Comment


                      • #12
                        Good question. %WS_EX_RIGHT means the control has "generic right-aligned properties", which are control class-dependent.

                        Therefore we can gather that this extended style has a particular effect for the Windows BUTTON class.

                        Bottom line is that it works.

                        However, the next update to the compiler will likely work correctly with %BS_LEFTTEXT.

                        ------------------
                        Lance
                        PowerBASIC Support
                        mailto:[email protected][email protected]</A>
                        Lance
                        mailto:[email protected]

                        Comment


                        • #13
                          Lance,

                          Speaking of compiler updates to PB/DLL 6.0, does PB's staff have
                          a target date for it being publicly available? I am VERY eager
                          to upgrade, as the WS_EX_RIGHT generates right-aligned controls,
                          which are very sloppy in appearance if the dialog has controls
                          with different text lengths.

                          Right now, for the programs in which that is unacceptable, I put
                          the dialog in an RC file, and use DialogBox to display it. The
                          controls' lines in the RC file contain BS_LEFTTEXT (BS_LEFT not required).
                          When pulled as a resource, those controls DO work as they should.



                          Regards,


                          ------------------
                          Clay C. Clear
                          http://www.v3space.com/a/a39/202/

                          beerw[email protected]

                          [This message has been edited by Clay Clear (edited July 13, 2001).]

                          Comment


                          • #14
                            PowerBASIC operates a "no vaporware" policy which precludes us from preannouncing updates and upgrades before they are actually ready for shipping.

                            However, I can probably get away with telling you that the update is not very far away now.

                            ------------------
                            Lance
                            PowerBASIC Support
                            mailto:[email protected][email protected]</A>
                            Lance
                            mailto:[email protected]

                            Comment

                            Working...
                            X