Moi, je ne connaissais pas. Et vous ? Du moins dans un stringGadget
Code : Tout sélectionner
;
; StringGadget Multiligne...
;
Procedure OpenWindow_Window_0()
If OpenWindow(0, 458, 203, 230, 175, "#Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If CreateGadgetList(WindowID(0))
Const=#ES_MULTILINE|#ES_AUTOVSCROLL|#WS_VSCROLL|#WS_HSCROLL|#ESB_DISABLE_LEFT|#ESB_DISABLE_RIGHT
StringGadget(1, 5, 5, 200, 150,"",Const)
EndIf
EndIf;
EndProcedure
OpenWindow_Window_0()
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Code : Tout sélectionner
L'intéressant :
C'est que apparemment on peux mélanger des constates API du type :
#ES_AUTOVSCROLL|
#WS_VSCROLL|
#WS_HSCROLL|
#ESB_DISABLE_LEFT|
#ESB_DISABLE_RIGHT
A moins qu'il n'y ai que moi qui n'était pas au courant ? Sad
En tout cas ces constantes n'existent pas dans la Doc normale...
A moins que je n'ai pas lu assez ?
Bref, c'est bien et ça marche bien....

Et puis il y a ceci.... Sur les même base ....
Mais ici on contrôle la longueur de l'entrée et aussi sur qu'elle partie du clavier on appuye... !
Code : Tout sélectionner
; *******************************************************************************************
; Autre options pour contrôler le clavier et les retour à la ligne en fin de saisie... *
; Aussi la limitation du nombre de caractères GeBonet *
; *******************************************************************************************
; Thanks to Art Sentinel (Forum Russe)
; *******************************************************************************************
Global hhook
Global hookValue.b : hookValue = 0
Global CommaPoint.b : CommaPoint = 0
#StringID1 = 11
#StringID2 = 14
;*******************
;PROCEDURES Contrôle des caractères entré à partir du clavier normal... (Pas numérique)
;*******************
Procedure KeyboardProc(nCode, wParam, lParam)
Define.b Result
If wParam < 31
Result = 0
ElseIf wParam = 188 And CommaPoint = 0 ;","
Result = 0
ElseIf wParam = 8 ;Del
Result = 0
ElseIf wParam = 37 ;ArrowLeft
Result = 0
ElseIf wParam = 38 ;ArrowUp
Result = 0
ElseIf wParam = 39 ;ArrowRight
Result = 0
ElseIf wParam = 40 ;ArrowDown
Result = 0
ElseIf wParam = 46 ;Entf
Result = 0
ElseIf wParam = 48 ;0
Result = 0
ElseIf wParam = 49 ;1
Result = 0
ElseIf wParam = 50 ;2
Result = 0
ElseIf wParam = 51 ;3
Result = 0
ElseIf wParam = 52 ;4
Result = 0
ElseIf wParam = 53 ;5
Result = 0
ElseIf wParam = 54 ;6
Result = 0
ElseIf wParam = 55 ;7
result = 0
ElseIf wParam = 56 ;8
Result = 0
ElseIf wParam = 57 ;9
Result = 0
Else
Result = 1
EndIf
ProcedureReturn Result
EndProcedure
;***********
;***********
Procedure HookProc(Hooked)
Shared hhook
Shared CommaPoint
Select Hooked
Case 1
hInstance = GetModuleHandle_(0)
lpdwProcessId = GetWindowThreadProcessId_(WindowID, 0)
hhook = SetWindowsHookEx_(#WH_KEYBOARD, @KeyboardProc(), hInstance, lpdwProcessId)
Case 0
UnhookWindowsHookEx_(hhook)
EndSelect
EndProcedure
;************
;************
WindowID = OpenWindow(0, 150, 150, 300, 300, "Filtre de Decimale (Thanks to Art Sentinel)", #PB_Window_SystemMenu)
If WindowID <> 0
;GadgetList
;If CreateGadgetList(WindowID(0))
TextGadget(10, 50, 96, 180, 22, "Sans Filtre :")
StringGadget(#StringID1, 50, 120, 180, 22, "") : SendMessage_(GadgetID(#StringID1), #EM_LIMITTEXT, 20, 0)
; #EM_LIMITTEXT = $C5
; La constante : EM_LIMITTEXT donne les limites du texte ou de son édition (contrôle).
; The text limit is the maximum amount of text, in TCHARs, that the user can type into the edit control.
; You can send this message to either an edit control or a rich edit control.
TextGadget(12, 50, 166, 180, 22, "Filtre les décimales :")
StringGadget(#StringID2, 50, 190, 180, 22, "") : SendMessage_(GadgetID(#StringID2), #EM_LIMITTEXT, 20, 0)
SetActiveGadget(#StringID1)
;Main loop
Repeat
Select WaitWindowEvent()
Case #WM_KEYDOWN
If EventwParam() = 13
Select EventGadget()
Case #StringID1
text$ = GetGadgetText(#StringID2)
SendMessage_(GadgetID(#StringID2), #EM_SETSEL, 0, Len(text$))
SetActiveGadget(#StringID2)
Case #StringID2
text$ = GetGadgetText(#StringID1)
SendMessage_(GadgetID(#StringID1), #EM_SETSEL, 0, Len(text$))
SetActiveGadget(#StringID1)
EndSelect
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case #StringID2
Text$=GetGadgetText(#StringID2)
StLength = Len(Text$)
CommaPoint = 0
If StLength > 0
For counter = 1 To StLength
If Mid(Text$,counter,1) = ","
CommaPoint = CommaPoint + 1
EndIf
Next
EndIf
If hookValue = 0 : hookValue = 1 : HookProc(1) : EndIf
Default
If hookValue = 1 : hookValue = 0 : HookProc(0) : EndIf
EndSelect
Case #WM_CLOSE
Quit = 1
EndSelect
Until Quit = 1
;EndIf
EndIf
End
