Als PureBasicNeuling habe ich da folgende Frage:
Ich befülle ein EditorGedget
Code: Alles auswählen
SendMessage_(GadgetID(0), #WM_PASTE, 0, 0)
Wie kann ich das am besten lösen?
Grüße Commander
Code: Alles auswählen
SendMessage_(GadgetID(0), #WM_PASTE, 0, 0)
Code: Alles auswählen
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Editor_0
#Button_0
#Text_0
#Button_1
#Button_2
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 216, 0, 600, 300, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
EditorGadget(#Editor_0, 10, 80, 340, 170)
ButtonGadget(#Button_0, 380, 50, 210, 40, "Hol Clipboard ohne Formatierung")
TextGadget(#Text_0, 0, 40, 260, 30, "Da unten wird der Inhalt der Zwischenablage eingefügt ")
ButtonGadget(#Button_1, 380, 100, 210, 40, "Hol Clipboard mit Formatierung")
ButtonGadget(#Button_2, 380, 190, 210, 40, "Tschö")
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #Editor_0
ElseIf GadgetID = #Button_0
SetGadgetText(#Editor_0,GetClipboardText())
ElseIf GadgetID = #Button_1
SendMessage_(GadgetID(0), #WM_PASTE, 0, 0)
ElseIf GadgetID = #Button_2
End
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;
Code: Alles auswählen
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Editor_0
#Button_0
#Text_0
#Button_1
#Button_2
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 216, 0, 600, 300, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
EditorGadget(#Editor_0, 10, 80, 340, 170)
ButtonGadget(#Button_0, 380, 50, 210, 40, "Hol Clipboard ohne Formatierung")
TextGadget(#Text_0, 0, 40, 260, 30, "Da unten wird der Inhalt der Zwischenablage eingefügt ")
ButtonGadget(#Button_1, 380, 100, 210, 40, "Hol Clipboard mit Formatierung")
ButtonGadget(#Button_2, 380, 190, 210, 40, "Tschö")
EndIf
EndIf
EndProcedure
Open_Window_0()
AddKeyboardShortcut(#Window_0,#PB_Shortcut_V|#PB_Shortcut_Control,88)
AddKeyboardShortcut(#Window_0,#PB_Shortcut_Insert|#PB_Shortcut_Control,88)
Repeat ; Start of the event loop
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
EventMenu= EventMenu()
If EventMenu=88
SetGadgetText(#Editor_0,GetClipboardText())
AddGadgetItem(#Editor_0,-1,"Tastenfreak?") ;das kann natürlich raus
EndIf
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_Event_Gadget
If GadgetID = #Editor_0
ElseIf GadgetID = #Button_0
SetGadgetText(#Editor_0,GetClipboardText())
ElseIf GadgetID = #Button_1
SendMessage_(GadgetID(0), #WM_PASTE, 0, 0)
ElseIf GadgetID = #Button_2
End
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
Code: Alles auswählen
SetGadgetText(#GadgetNr,"") ;das Gadget muss leer sein - MS will es so...
SendMessage_(GadgetID(#GadgetNr),#EM_SETTEXTMODE,#TM_PLAINTEXT,0)