Salut,
J'ai pas trouver comment Renvoyer le nombre de caractères sélectionné dans un editor gadget, dans les tutos, ni dans mes affaires.
Une cht'ite idée svp ?
Renvoyer le nombre de caractères sélectionné dans un éditor
Renvoyer le nombre de caractères sélectionné dans un éditor
Processeur: Intel Core I7-4790 - 4 Cœurs - 8 Thread: 3.60 Ghz.
Ram: 32 GB.
Disque: C: SDD 250 GB, D: 3 TB.
Vidéo: NVIDIA GeForce GTX 960: 2 GB DDR5.
Écran: Asus VX248 24 Pouces: 1920 x 1080.
Système: Windows 7 64 Bits.
PureBasic: 5.60 x64 Bits.
Ram: 32 GB.
Disque: C: SDD 250 GB, D: 3 TB.
Vidéo: NVIDIA GeForce GTX 960: 2 GB DDR5.
Écran: Asus VX248 24 Pouces: 1920 x 1080.
Système: Windows 7 64 Bits.
PureBasic: 5.60 x64 Bits.
- falsam
- Messages : 7324
- Inscription : dim. 22/août/2010 15:24
- Localisation : IDF (Yvelines)
- Contact :
Re: Renvoyer le nombre de caractères sélectionné dans un édi
Avec API Windows
@Olivier : Oui Size n'est pas signé !!! Et alors hein ? 
Code : Tout sélectionner
EnableExplicit
Enumeration window
#mf
EndEnumeration
Enumeration gadget
#editor
EndEnumeration
Enumeration shortcut
#ctrlC
EndEnumeration
Procedure GetSelectString()
Protected Range.CHARRANGE, Size
SendMessage_(GadgetID(#editor), #EM_EXGETSEL, 0, Range)
Size = (Range\cpMax - Range\cpMin)
Debug Size
EndProcedure
If OpenWindow(#mf, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(#editor, 8, 8, 306, 133)
; Interception de la touche Ctrl-C
AddKeyboardShortcut(#mf, #PB_Shortcut_Control | #PB_Shortcut_C, #ctrlC)
; Evenement Ctrl-C
BindEvent(#PB_Event_Menu, @GetSelectString(), #mf, #ctrlC)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Re: Renvoyer le nombre de caractères sélectionné dans un édi
Merci Falsam 

Processeur: Intel Core I7-4790 - 4 Cœurs - 8 Thread: 3.60 Ghz.
Ram: 32 GB.
Disque: C: SDD 250 GB, D: 3 TB.
Vidéo: NVIDIA GeForce GTX 960: 2 GB DDR5.
Écran: Asus VX248 24 Pouces: 1920 x 1080.
Système: Windows 7 64 Bits.
PureBasic: 5.60 x64 Bits.
Ram: 32 GB.
Disque: C: SDD 250 GB, D: 3 TB.
Vidéo: NVIDIA GeForce GTX 960: 2 GB DDR5.
Écran: Asus VX248 24 Pouces: 1920 x 1080.
Système: Windows 7 64 Bits.
PureBasic: 5.60 x64 Bits.