Multiple lines of text on a Button

Started by mcvpjd3, June 01, 2016, 09:20:40 AM

Previous topic - Next topic

mcvpjd3

Can you put multiple lines of text on a pushbutton in a dialog? If so, how?

Thanks

td

It is not directly supported.  One way to accomplish it, however,  is to create a bitmap image with your text and display that in a PICTUREBUTTON.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Another approach would be to give a button the multiline button style in the initialization section of the a dialog callback:

Code (winbatch) Select
#DefineSubroutine MLButtonProc(MLButton_Handle,MLButton_Event,MLButton_Name,MLButton_EventInfo,MLButton_ChangeInfo)
   switch MLButton_Event                                    ; Switch based on Dialog Message type
      case @deInit  ; Standard Initialization message
         BS_MULTILINE = 8192
         BS_CHECKBOX = 2

         hControl = DialogControlGet(MLButton_Handle, "PushButton_OK",  @dchWnd)
         hUser32 = DllLoad("User32.dll")
         CtrlStyle = DllCall(hUser32, long:"GetWindowLongW", long:hControl, long:-16)
         DllCall(hUser32, long:"SetWindowLongW", long:hControl, long:-16, long:(CtrlStyle&(~BS_CHECKBOX))^BS_MULTILINE)
         DllFree(hUser32)
         DialogControlSet(MLButton_Handle, "PushButton_OK", @dcTitle, "Line one":@CRLF:"Line Two")
         return(@retDefault)
   endswitch                                               
   return(@retDefault)
#EndSubroutine                                              ; End of Dialog Callback MLButtonCallbackProc

MLButtonFormat=`WWWDLGED,6.2`

MLButtonCaption=`Multiline Button Example`
MLButtonX=081
MLButtonY=099
MLButtonWidth=408
MLButtonHeight=166
MLButtonNumControls=002
MLButtonProcedure=`MLButtonProc`
MLButtonFont=`DEFAULT`
MLButtonTextColor=`DEFAULT`
MLButtonBackground=`DEFAULT,DEFAULT`
MLButtonConfig=0

MLButton001=`111,111,068,048,CHECKBOX,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
MLButton002=`261,147,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MLButton")
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kdmoyers

Nice Tony! I actually have an immediate use for that!
-Kirby
The mind is everything; What you think, you become.