does anyone know how I can assign a placeholder text to the editor gadget?
I have not found anything with the forum search.
Chat GPT has suggested an interesting, working solution - but isn't there a simpler way?
Code: Select all
; Created by ChatGPT4
; Konstanten für die Gadget-IDs
Enumeration
#Editor
EndEnumeration
; Initialer Platzhaltertext
Global Placeholder$ = "Bitte Text eingeben..."
; Fenster und EditorGadget erstellen
If OpenWindow(0, 100, 100, 300, 100, "Editor mit Platzhalter", #PB_Window_SystemMenu)
EditorGadget(#Editor, 10, 10, 280, 80)
SetGadgetText(#Editor, Placeholder$)
; Ereignisschleife
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case #Editor
If EventType() = #PB_EventType_Focus
If GetGadgetText(#Editor) = Placeholder$
SetGadgetText(#Editor, "")
EndIf
ElseIf EventType() = #PB_EventType_LostFocus
If Len(GetGadgetText(#Editor)) = 0
SetGadgetText(#Editor, Placeholder$)
EndIf
EndIf
EndSelect
EndSelect
Until Event() = #PB_Event_CloseWindow
EndIf

