Question

I want to create a text box of height 30 and the text it uses has font 11pt. Somehow the text always appear at the upper part of box. I want to achieve vertical center alignment for it. Does anyone know how it can be done?

Function fnc_Directoryrequest_Create

  ; custom font definitions
  CreateFont $hCtl_Directoryrequest_Font1 "Calibri" "11" "400"

  nsDialogs::Create 1018
  Pop $hCtl_Directoryrequest
  ${If} $hCtl_Directoryrequest == error
    Abort
  ${EndIf}

  ${NSD_CreateText} 37u 42u 327 30 "C:\mySample\TestLocation\here"
  Pop $hCtl_Directoryrequest_DirRequest1_Txt
  SendMessage $hCtl_Directoryrequest_DirRequest1_Txt ${WM_SETFONT} $hCtl_Directoryrequest_Font1 0

  ${NSD_CreateButton} 253u 40u 35 30 "..."
  Pop $hCtl_Directoryrequest_DirRequest1_Btn
  SendMessage $hCtl_Directoryrequest_DirRequest1_Btn ${WM_SETFONT} $hCtl_Directoryrequest_Font1 0
  ${NSD_OnClick} $hCtl_Directoryrequest_DirRequest1_Btn fnc_hCtl_Directoryrequest_DirRequest1_Click

FunctionEnd
Was it helpful?

Solution

The standard edit control does NOT have a vertical align style and EM_SETRECT only works for multi-line edit controls.

If you really think this is something you need then your only option is to write a NSIS plugin that can create a custom edit control.

I would suggest that you just use 12u as the height and the default font...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top