Показать полную графическую версию : [решено] GUICtrlCreateInput (переход в начало)
malev79@vk
14-08-2013, 14:54
Подскажите можно ли перейти в начало данного контрола, если весь текст не помещается. По умолчанию курсор остается за последним символом а надо чтобы был в начале. Вручную помогает нажатие клавишы "Home".
GUICtrlCreateInput ("Ну очень, очень длинный текст здесь находится",120,50,50,20)
можно ли перейти в начало данного контрола, если весь текст не помещается »
Что значит перейти?
Если по некой кнопке, то можно так:
#include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <EditConstants.au3>
$hGUI = GUICreate (http://autoit-script.ru/autoit3_docs/functions/GUICreate.htm)("Test Script", 300, 200)
$iInput = GUICtrlCreateInput (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateInput.htm)("Ну очень, очень длинный текст здесь находится", 20, 30, 100, 20)
$iSetCarret_Bttn = GUICtrlCreateButton (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateButton.htm)("Set carret to begining", 20, 60, 120, 20)
GUISetState (http://autoit-script.ru/autoit3_docs/functions/GUISetState.htm)(@SW_SHOW (http://autoit-script.ru/autoit3_docs/macros.htm#@sw_show), $hGUI)
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) GUIGetMsg (http://autoit-script.ru/autoit3_docs/functions/GUIGetMsg.htm)()
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $iSetCarret_Bttn
GUICtrlSendMsg (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSendMsg.htm)($iInput, $EM_SETSEL, 0, 0)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
malev79@vk
15-08-2013, 09:45
Думаю подойдет такой вариант, нужно для указания пути к файлу, который может быть очень длинным.
А так было бы неплохо если сразу бы без кнопки в начало переходил.
malev79@vk, уже ж спрашивали — как переходил:
Что значит перейти? »
?! В какой момент? При получении полем фокуса?
было бы неплохо если сразу бы без кнопки в начало переходил »
#include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <EditConstants.au3>
#include (http://autoit-script.ru/autoit3_docs/keywords.htm##include) <WindowsConstants.au3>
$hGUI = GUICreate (http://autoit-script.ru/autoit3_docs/functions/GUICreate.htm)("Test Script", 300, 200)
$iInput = GUICtrlCreateInput (http://autoit-script.ru/autoit3_docs/functions/GUICtrlCreateInput.htm)("", 20, 30, 100, 20)
GUISetState (http://autoit-script.ru/autoit3_docs/functions/GUISetState.htm)(@SW_SHOW (http://autoit-script.ru/autoit3_docs/macros.htm#@sw_show), $hGUI)
GUIRegisterMsg (http://autoit-script.ru/autoit3_docs/functions/GUIRegisterMsg.htm)($WM_COMMAND, "WM_COMMAND")
GUICtrlSetData (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSetData.htm)($iInput, "Ну очень, очень длинный текст здесь находится", 1)
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) GUIGetMsg (http://autoit-script.ru/autoit3_docs/functions/GUIGetMsg.htm)()
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $GUI_EVENT_CLOSE
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) WM_COMMAND($hWnd, $nMsg, $wParam, $lParam)
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $nNotifyCode = BitShift (http://autoit-script.ru/autoit3_docs/functions/BitShift.htm)($wParam, 16)
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $nID = BitAND (http://autoit-script.ru/autoit3_docs/functions/BitAND.htm)($wParam, 0xFFFF)
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $hCtrl = $lParam
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $nID
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $iInput
Switch (http://www.autoitscript.com/autoit3/docs/keywords.htm#Switch) $nNotifyCode
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $EN_CHANGE, $EN_UPDATE
GUICtrlSendMsg (http://autoit-script.ru/autoit3_docs/functions/GUICtrlSendMsg.htm)($iInput, $EM_SETSEL, 0, 0)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
EndSwitch (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSwitch)
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $GUI_RUNDEFMSG
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
А так было бы неплохо если сразу бы без кнопки в начало переходил »
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
$hGUI = GUICreate("Test Script", 300, 200)
$PathInput = GUICtrlCreateInput("Выберите...", 20, 30, 100, 20)
$PathButton=GUICtrlCreateButton("...", 120, 30, 30, 20)
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $PathButton
$var = FileOpenDialog("Выберите нужный файл", @systemDir & "\", "Рисунки (*.jpg;*.bmp)", 1, "OEMLogo.bmp")
if Not @error Then
GUICtrlSetData($PathInput, $var)
else
GUICtrlSetData($PathInput, "Выберите...")
endif
GUICtrlSendMsg($PathInput, $EM_SETSEL, 0, 0)
EndSwitch
WEnd
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.