Search the Community
Showing results for tags 'font weight'.
-
Hi all, is there any way to get the font weight of a label? Setting the font weight is easy going (GUICtrlSetFont), but reading it is not so much fun. Background (what I want to achieve): in my tools, there are lots of labels. The User shall be able to copy the label-text by clicking on it. But I want to differ between the static labels (the description-labels) and the labels containing the useful informations. The latter ones are bold (font weight 800), the other ones are not. Example: #include <GUIConstants.au3> $Form1 = GUICreate("Test", 250, 50, -1, -1) GUICtrlCreateLabel("Username:", 10, 10, 90, 17) $lbl_name = GUICtrlCreateLabel("Jane Doe", 100, 10, 90, 17) GUICtrlSetFont(-1, -1, 800) GUISetState(@SW_SHOW, $Form1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case -100 To 0 ; ignore Case Else $tmp = GUICtrlRead($nMsg) ClipPut($tmp) MsgBox(0, "Text has been copied", $tmp) EndSwitch Sleep(50) WEnd In this form, I want the text of $lbl_name to get copied when the label is clicked on, but when clicking the label without a variable, nothing shall happen. Of course, I could throw each and every $lbl-variable into an separate Case-segment in the switch-statement. But I am looking for a more lazy generic solution, what brought me to the idea of "if _labelfontwidth($nMsg)<800 then Continueloop". Any ideas?