Archive: label alignment


label alignment
  Hi,

I am trying to figure out how to place a static text label in a dialog and have it centered (i.e. something like CreateLabel with width 100% but tell the control to align the text to the center).

Thanks!


If you are using nsDialogs, it is simple:

${NSD_CreateLabel} 0 190 100% 20 "Test"  
pop $lblTest
${NSD_AddStyle} $lblTest ${SS_CENTER}



Look here for more styles:
http://msdn.microsoft.com/en-us/library/9h0ay857.aspx

Regards,
Johan

given the handle to your label control in $hwnd, use...

${NSD_AddStyle} $hwnd ${SS_CENTER} 
...before displaying the dialog.

Example:

"nsDialogs.nsh"


>OutFile "$%temp%\temp.exe"

>var dialog
>var hwnd
>var null

>Var hUpDown

Page custom Test

>Function Test
nsDialogs
::Create 1018
Pop $dialog

${NSD_CreateLabel} 0 0 100% 20% "This is a test$\nThis is only a test."
Pop $hwnd
${NSD_AddStyle} $hwnd ${SS_CENTER}

nsDialogs::Show
FunctionEnd


Section
SectionEnd
>
For more Static Control Styles, see:
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

Thanks! works like a charm :-)


odd.. JohaViss's reply suddenly popped up and inserted itself in the middle.. silly forums :)
'll stick it in the the FAQ as well, gotta add that updown control thing anyway