Re: Textgadget
Verfasst: 26.03.2014 12:58
Hm...
Kannst du deinen Code posten oder wie genau ermittelst du den Text?
Code: Alles auswählen
EnableExplicit
Define EventID
Global TextGadgetBackground = GetStockObject_(#HOLLOW_BRUSH)
Procedure WinProc(hWnd, Msg, wParam, lParam)
Protected GadgetNr
Select Msg
Case #WM_CTLCOLORSTATIC
GadgetNr = GetProp_(lParam, "PB_ID")
Select GadgetNr
Case 0, 1, 2
SetBkMode_(wParam, #TRANSPARENT)
SetTextColor_(wParam, GetGadgetColor(GadgetNr, #PB_Gadget_FrontColor))
ProcedureReturn TextGadgetBackground
EndSelect
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(0, 10, 10, 250, 20, "This TextGadget has a transparent background")
TextGadget(1, 10, 30, 250, 20, "This TextGadget has a transparent background")
TextGadget(2, 10, 50, 250, 20, "This TextGadget has a transparent background")
SetGadgetColor(1, #PB_Gadget_FrontColor, RGB(0, 0, 255))
SetGadgetColor(0, #PB_Gadget_FrontColor, RGB(255, 0, 0))
SetWindowColor(0, RGB(255, 255, 0))
SetWindowCallback(@WinProc())
;==================================================
Debug GetGadgetText(1);Wird "This TextGadget has a transparent background" ausgegeben
;==================================================
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
DeleteObject_(TextGadgetBackground)
End
EndIf
ForEver
EndIf