VCENTERALIGN side effect

43 views
Skip to first unread message

Pete

unread,
Dec 24, 2019, 8:32:16 AM12/24/19
to Harbour Minigui
Hi,
LABEL VCENTERALIGN .T. is nice but has the unwelcome side effect to block out
the text wrapping, (see below sample code to understand what I mean).

#include "hmg.ch"
PROCEDURE
Main()


    DEFINE WINDOW
Form1 ;
            AT
0,0 ;
            WIDTH
400 ;
            HEIGHT
200 ;
            TITLE
"Label CenterAlign Demo" ;
            MAIN NOMAXIMIZE NOSIZE

           DEFINE LABEL
Label_1
               ROW    
40
               COL    
20
               WIDTH  
150
               HEIGHT
28
               VALUE
"A Label with VCENTERALIGN set to .F. (text wrap, yes!)"
               FONTNAME
"Segoe UI"
               FONTSIZE
8
               TOOLTIP
"VCENTERALIGN .F."
               VCENTERALIGN
.F.
         
END LABEL  

           DEFINE LABEL
Label_2
               ROW    
80
               COL    
20
               WIDTH  
150
               HEIGHT
28
               VALUE
"A Label with VCENTERALIGN set to .T. (text wrap no!)"
               FONTNAME
"Segoe UI"
               FONTSIZE
8
               TOOLTIP
"VCENTERALIGN .T."
               VCENTERALIGN
.T.
         
END LABEL  

   
END WINDOW
   
   
Form1.Center
   
Form1.Activate
   
    RETURN


Is it possible to fix it?  


regards,
Pete

P.S.: Merry Christmas and a Happy New Year to all!

Grigory Filatov

unread,
Dec 24, 2019, 9:17:59 AM12/24/19
to Harbour Minigui
Hi Pete,

Thanks for your interest.
But this side effect can not be fixed due to WinApi limitation:

" If the static control contains a single line of text, the text is
centered vertically in the client area of the control."

We can not use this style (SS_CENTERIMAGE) for multiline text. 

Merry Xmas to you!

HTH,
Grigory

Pete

unread,
Dec 24, 2019, 2:06:10 PM12/24/19
to Harbour Minigui
Hi Grigory,
I had a sense that the root of "trouble" could be the winAPI
but I  was expecting there might be a kind of a workaround.
Obviously is not possible; but anyway, it's not a big issue,
after all. Thanks for your reply!

regards,
Pete
Reply all
Reply to author
Forward
0 new messages