Font Weight and Button Size << Back



TL;DR - If you want to bold the text of a Button without changing its size, use the property "Form_FontWeight" instead of "FontWeight".

Details - The size of the control is based on the current font that it is using. If you specify a heavier font weight (as in bolding the text), your control will be bigger. That means if you have 2 controls with the "exact" same size (set size to 15 100), and one control is bold, while the other is not; you will notice that the bolded control will appear bigger. However, every Button control has a parent and a child control. We can use this to our advantage. By setting Form_FontWeight, you are only changing the font weight of the child window, thus it won't affect the size of the parent window. See Form_Window_Handle for details.

Use Windows.pkg
Object oPanel is a ModalPanel
	Set Size to 100 200
	Object oNormal is a Button
		Set Size to 15 100 // Same "Size" for every button
		Set Label to "Normal"
	End_Object
	Object oBoldSameSize is a Button
		Set Form_FontWeight to 700 // <--------
		Set Location to 15 0
		Set Size to 15 100 // Same "Size" for every button
		Set Label to "Bold, but same size"
	End_Object
	Object oBoldBigger is a Button
		Set FontWeight to 700 // <-------- 
		Set Location to 30 0
		Set Size to 15 100 // Same "Size" for every button
		Set Label to "Bold, but bigger"
	End_Object
End_Object

Send Popup of oPanel
Free Web Hosting