[bb] Buttons with multiple lines of text by Cold Harbour [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:42

Previous topic - Next topic

BlitzBot

Title : Buttons with multiple lines of text
Author : Cold Harbour
Posted : 1+ years ago

Description : Allows you to have button text on multiple lines.

Code :
Code: blitzbasic
; 	.lib "User32.dll"
;	GetWindowLong% (hwnd%, nIndex%) : "GetWindowLongA"
;	SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"

Const BM_SETSTYLE	=	244
Const GWL_STYLE		=	-16
Const BS_MULTILINE	=	8192

win=CreateWindow ("Win",10,10,600,600,main,15)

b1=Createmultibutton("A quite long bit of text to show multlineness",10,10,80,70,win,1)
b2=Createmultibutton("A quite long bit of text to show multlineness",10,100,90,70,win,2)
b3=Createmultibutton("A quite long bit of text to show multlineness",10,200,80,70,win,3)

While WaitEvent(10)<>$803
Wend
End 


Function Createmultibutton(name$, x, y, w, h, p,style) 

	button = CreateButton(name, x, y, w, h, p,style)

	hwnd = QueryObject(button, 1)

	SetWindowLong (hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Or BS_MULTILINE)

	;force button redraw kludge
	SetGadgetShape button,GadgetX(button),GadgetY(button),GadgetWidth (button)+1,GadgetHeight (button)
	SetGadgetShape button,GadgetX(button),GadgetY(button),GadgetWidth (button)-1,GadgetHeight (button)

	Return button

End Function


Comments : none...