Page 1 sur 1
[R] Descendre un scrolling automatiquement
Posté : jeu. 22 déc. 2011 18:27
par loockys
Salut, comment je peux descendre un scrolling automatiquement, S'il vous plait.
c'est-à dire que je cherche à laisser le scrolling en bas et non en haut pour qu'on puisse voir les dernières données entrée de chaque bouton presser.
D'avance merci.
(Je tiens à prouver que j'ai fait plusieurs recherches sur le forum et je suis tombé sur ça
http://autoitscript.fr/forum/viewtopic.php?f=3&t=7002 )
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Loockys", 615, 271, 195, 126)
$Edit1 = GUICtrlCreateEdit("", 16, 96, 521, 80)
GUICtrlSetData(-1, "")
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Lucas", 24, 24, 75, 25)
$Label1 = GUICtrlCreateLabel("12", 32, 56, 16, 17)
$Button2 = GUICtrlCreateButton("Richard", 112, 24, 75, 25)
$Label2 = GUICtrlCreateLabel("16", 120, 56, 16, 17)
$Button3 = GUICtrlCreateButton("Jane", 200, 24, 75, 25)
$Label3 = GUICtrlCreateLabel("24", 208, 56, 16, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Btn1()
case $Button2
_Btn2()
case $Button3
_Btn3()
EndSwitch
WEnd
Func _Btn1()
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead($Button1) & " ... " & GUICtrlRead($Label1)& @CRLF)
EndFunc
Func _Btn2()
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead($Button2) & " ... " & GUICtrlRead($Label2)& @CRLF)
EndFunc
Func _Btn3()
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead($Button3) & " ... " & GUICtrlRead($Label3)& @CRLF)
EndFunc
Re: [..]Descendre un scrolling automatiquement
Posté : jeu. 22 déc. 2011 20:01
par matwachich
Code : Tout sélectionner
#Include <GuiEdit.au3>
$hEdit = GuiCtrlGetHandle($Edit1)
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))
Re: [..]Descendre un scrolling automatiquement
Posté : jeu. 22 déc. 2011 21:11
par loockys
J'ai intégré le code et rien à changer, le scrolling ne descend pas automatiquement.
Re: [..]Descendre un scrolling automatiquement
Posté : jeu. 22 déc. 2011 21:49
par matwachich
Il faut ajouter le _LineScroll à chaque fois que vous écrivez dans votre Edit
Re: [..]Descendre un scrolling automatiquement
Posté : jeu. 22 déc. 2011 22:17
par loockys
Je suis sincèrement désoler mais, je ne vois pas de quoi vous parlez et ou vous voulez en venir.
Re: [..] Descendre un scrolling automatiquement
Posté : ven. 23 déc. 2011 01:08
par matwachich
Voila, j'en ai aussi profiter pour simplifier un peut votre code
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
$Form1 = GUICreate("Loockys", 615, 271, 195, 126)
$Edit1 = GUICtrlCreateEdit("", 16, 96, 521, 80)
$hEdit = GuiCtrlGetHandle($Edit1)
GUICtrlSetData(-1, "")
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Lucas", 24, 24, 75, 25)
$Label1 = GUICtrlCreateLabel("12", 32, 56, 16, 17)
$Button2 = GUICtrlCreateButton("Richard", 112, 24, 75, 25)
$Label2 = GUICtrlCreateLabel("16", 120, 56, 16, 17)
$Button3 = GUICtrlCreateButton("Jane", 200, 24, 75, 25)
$Label3 = GUICtrlCreateLabel("24", 208, 56, 16, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Btn(1)
case $Button2
_Btn(2)
case $Button3
_Btn(3)
EndSwitch
WEnd
Func _Btn($param)
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead(Eval("Button" & $param)) & " ... " & GUICtrlRead(Eval("Label" & $param))& @CRLF)
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))
EndFunc
Re: [R] Descendre un scrolling automatiquement
Posté : sam. 24 déc. 2011 11:20
par loockys
Merci au passage matwachich pour la petite astuce, elle allège le script c'est sympa de ta part.
Je vais laisser un exemple en couleur des changements de mon tout premier script.
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
[color=#40BF00]#Include <GuiEdit.au3>[/color]
$Form1 = GUICreate("Loockys", 615, 271, 195, 126)
$Edit1 = GUICtrlCreateEdit("", 16, 96, 521, 80)
[color=#40BF00]$hEdit = GuiCtrlGetHandle($Edit1)[/color]
GUICtrlSetData(-1, "")
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Lucas", 24, 24, 75, 25)
$Label1 = GUICtrlCreateLabel("12", 32, 56, 16, 17)
$Button2 = GUICtrlCreateButton("Richard", 112, 24, 75, 25)
$Label2 = GUICtrlCreateLabel("16", 120, 56, 16, 17)
$Button3 = GUICtrlCreateButton("Jane", 200, 24, 75, 25)
$Label3 = GUICtrlCreateLabel("24", 208, 56, 16, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Btn1()
case $Button2
_Btn2()
case $Button3
_Btn3()
EndSwitch
WEnd
Func _Btn1()
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead($Button1) & " ... " & GUICtrlRead($Label1)& @CRLF)
[color=#40BF00]_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))[/color]
EndFunc
Func _Btn2()
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead($Button2) & " ... " & GUICtrlRead($Label2)& @CRLF)
[color=#40BF00]_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))[/color]
EndFunc
Func _Btn3()
GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Clients : " & GUICtrlRead($Button3) & " ... " & GUICtrlRead($Label3)& @CRLF)
[color=#00BF00]_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))[/color]
EndFunc
EDIT : Script corriger.
Re: [R] Descendre un scrolling automatiquement
Posté : sam. 24 déc. 2011 13:37
par matwachich
Y'a pas de quoi!
Au passage, le premier _LineScroll() dans la déclaration de la GUI ne sert à rien.