Code : Tout sélectionner
SetClipboardText(Texte$)
merci
Code : Tout sélectionner
SetClipboardText(Texte$)
Code : Tout sélectionner
;- Window Constants
Enumeration
#Win_0
EndEnumeration
;- Gadget Constants
Enumeration
#Editor_0
#Btn_0
EndEnumeration
Procedure Open_Win_0()
If OpenWindow(#Win_0, 216, 0, 305, 300, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "New window ( 0 )")
If CreateGadgetList(WindowID())
EditorGadget(#Editor_0, 5, 5, 295, 260)
ButtonGadget(#Btn_0, 70, 270, 170, 25, "Quitter")
EndIf
EndIf
EndProcedure
If CreatePopupMenu(0)
MenuItem(1, "Couper")
MenuItem(2, "Copier")
MenuItem(3, "Coller")
MenuBar()
MenuItem(4, "Annuler")
MenuItem(5, "Refaire")
MenuBar()
MenuItem(6, "Quitter")
EndIf
Open_Win_0()
Repeat
Select WaitWindowEvent()
Case #WM_RButtonDown
DisplayPopupMenu(0, WindowID())
Case #PB_EventMenu
Select EventMenuID()
Case 1 ; Couper
Vide$ = ""
SendMessage_(GadgetID(#Editor_0),#EM_GETSEL,@StartSel,@EndSel)
Buffer$ = Space(EndSel-StartSel)
SendMessage_(GadgetID(#Editor_0),#EM_GETSELTEXT,0,@Buffer$)
ClearClipboard()
SetClipboardText(Buffer$)
SendMessage_(GadgetID(#Editor_0),#EM_REPLACESEL,#True,@Vide$)
Case 2 ; Copier
SendMessage_(GadgetID(#Editor_0),#EM_GETSEL,@StartSel,@EndSel)
Buffer$ = Space(EndSel-StartSel)
SendMessage_(GadgetID(#Editor_0),#EM_GETSELTEXT,0,@Buffer$)
ClearClipboard()
SetClipboardText(Buffer$)
Case 3 ; Coller
Buffer$ = GetClipboardText()
SendMessage_(GadgetID(#Editor_0),#EM_REPLACESEL,#True,@Buffer$)
Case 4 ; Annuler
SendMessage_(GadgetID(#Editor_0),#EM_UNDO,0,0)
Case 5 ; Refaire
SendMessage_(GadgetID(#Editor_0),#EM_REDO,0,0)
Case 6 ; Quitter
quit = 1
EndSelect
Case #PB_EventGadget
Select EventGadgetID()
Case #Editor_0
Case #Btn_0
quit = 1
EndSelect
Case #PB_EventCloseWindow
quit = 1
EndSelect
Until quit = 1
End
Code : Tout sélectionner
If OpenWindow(0,0,0,322,150,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"EditorGadget") And CreateGadgetList(WindowID(0))
Hedit=EditorGadget (0,8,8,306,133,#PB_Container_Raised)
If CreatePopupMenu(0)
MenuItem(1, "Couper")
MenuItem(2, "Copier")
MenuItem(3, "Coller")
EndIf
EndIf
Repeat
EventID.l = WindowEvent()
Select EventID
Case #WM_RButtonDown
DisplayPopupMenu(0, WindowID())
Case #PB_EventMenu
Select EventMenuID()
Case 1 ; Couper
SendMessage_(Hedit, #WM_CUT, 0, 0)
Case 2 ; Copier
SendMessage_(Hedit, #WM_COPY, 0, 0)
Case 3 ; Coller
SendMessage_(Hedit, #WM_PASTE, 0, 0)
EndSelect
EndSelect
Until EventID = #PB_EventCloseWindow
End