Announcement

Collapse
No announcement yet.

Multiline centered text in a button

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

  • Dave Biggs
    replied
    George, I reckon the answer is in the Use XP/Vista Look/Feel settings..
    I can get the behaviour you see by changing the setting of Tools/Options/General "Use XP/Vista Look/Feel.
    When that setting is Checked, but the CodeGeneration option is UnChecked the text is rendered left aligned in dev / test mode but centered when compiled.
    Looks like you need both On or both Off for consistant results (and don't forget Save AS New...)
    I should also have added that I could only get that behaviour if I set my PC's display properties to 'Windows Classic style'.
    (That was with both my home PC - WinXP Home and office PC - WinXP Professional). Maybe your laptop is set for 'Windows XP style' ?

    See what effects you get changing one or both of those check boxes on your PC.

    Leave a comment:


  • George Bleck
    replied
    OK, so loaded PBForms on my laptop (originally installed it on my desktop) and the above code works fine there.

    Gotta be something specific to my PC then, just not sure what. I'll report back an answer when I get a solution.
    Last edited by George Bleck; 19 Nov 2009, 07:02 PM.

    Leave a comment:


  • George Bleck
    replied
    I had posted a bad version of it and corrected it about 10 mins later. You grabbed the previous copy.

    In any event, I recreated the whole thing AGAIN (and compiled it successfuly) so just grab the code block again.

    Leave a comment:


  • Dave Biggs
    replied
    Hi George - yes I'm using 2.0

    Ok as posted the code won't compile because of an undeclared equate here..
    Code:
    FUNCTION PBMAIN()
      PBFormsInitComCtls (%ICC_WIN95_CLASSES OR %ICC_DATE_CLASSES OR %ICC_INTERNET_CLASSES)
     
      ShowdlgMain %HWND_DESKTOP
    END FUNCTION
    But that gives a clue as to what the problem might be..

    For "PBFormsInitComCtls.." to be added to your code you must have Tools/Options/CodeGeneration "Add XP/Vista Look/Feel" Checked.

    But that would also Add..
    Code:
    #PBFORMS BEGIN INCLUDES 
    #RESOURCE "Noname1.pbr"
    #INCLUDE ONCE "WIN32API.INC"
    #INCLUDE ONCE "COMMCTRL.INC"
    #INCLUDE ONCE "PBForms.INC"
    #PBFORMS END INCLUDES
    (Including "PBForms.INC" fixes the undeclared equate problem)

    So my guess is that you changed the Option but didn't "Save As New" ?

    I can get the behaviour you see by changing the setting of Tools/Options/General "Use XP/Vista Look/Feel.
    When that setting is Checked, but the CodeGeneration option is UnChecked the text is rendered left aligned in dev / test mode but centered when compiled.
    Looks like you need both On or both Off for consistant results (and don't forget Save AS New...)

    Leave a comment:


  • George Bleck
    replied
    Dave are you using PBForms 2.0?

    On my machine (WinXP Professional) this exact code...

    Code:
    #PBFORMS CREATED V2.00
    #COMPILE EXE
    #DIM ALL
    #PBFORMS BEGIN INCLUDES 
    #INCLUDE ONCE "WIN32API.INC"
    #PBFORMS END INCLUDES
    #PBFORMS BEGIN CONSTANTS 
    %dlgMain           = 1001
    %btnMinimizeToTray = 1002
    #PBFORMS END CONSTANTS
    DECLARE CALLBACK FUNCTION ShowdlgMainProc()
    DECLARE FUNCTION ShowdlgMain(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    FUNCTION PBMAIN()
        ShowdlgMain %HWND_DESKTOP
    END FUNCTION
    CALLBACK FUNCTION ShowdlgMainProc()
        SELECT CASE AS LONG CB.MSG
            CASE %WM_INITDIALOG
            CASE %WM_NCACTIVATE
                STATIC hWndSaveFocus AS DWORD
                IF ISFALSE CB.WPARAM THEN
                    hWndSaveFocus = GetFocus()
                ELSEIF hWndSaveFocus THEN
                    SetFocus(hWndSaveFocus)
                    hWndSaveFocus = 0
                END IF
            CASE %WM_COMMAND
                SELECT CASE AS LONG CB.CTL
                    CASE %btnMinimizeToTray
                        IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
                            MSGBOX "%btnMinimizeToTray=" + _
                                FORMAT$(%btnMinimizeToTray), %MB_TASKMODAL
                        END IF
                END SELECT
        END SELECT
    END FUNCTION
    FUNCTION ShowdlgMain(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
    #PBFORMS BEGIN DIALOG %dlgMain->->
        LOCAL hDlg  AS DWORD
        DIALOG NEW hParent, "Main dialog", 70, 70, 201, 121, TO hDlg
        CONTROL ADD BUTTON, hDlg, %btnMinimizeToTray, "Minimize to tray", 75, 45, _
            50, 30, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_TEXT OR _
            %BS_MULTILINE OR %BS_PUSHBUTTON OR %BS_CENTER OR %BS_VCENTER, _
            %WS_EX_LEFT OR %WS_EX_LTRREADING
    #PBFORMS END DIALOG
        DIALOG SHOW MODAL hDlg, CALL ShowdlgMainProc TO lRslt
    #PBFORMS BEGIN CLEANUP %dlgMain
    #PBFORMS END CLEANUP
        FUNCTION = lRslt
    END FUNCTION
    Appears like this...

    Attached Files
    Last edited by George Bleck; 19 Nov 2009, 11:05 AM.

    Leave a comment:


  • Dave Biggs
    replied
    Seems OK here (WinXP Home).

    Are you adding the button text outside of the Btton Properties dialog?


    Attached Files

    Leave a comment:


  • George Bleck
    started a topic Multiline centered text in a button

    Multiline centered text in a button

    Minor weirdness I noticed...It appears that PBForms 2.0 does not properly render multiline centered text in a button.

    Looking at the attached graphic the lower left dialog is what it looks like in dev'ing PBForms 2.0, the lower right one shows the actually compiled and running app. The top graphic is the properities window just to show it is actually set to center it.

    When compiled it works fine, its just how PBForms renders it in dev and test modes.
    Attached Files
Working...
X