MrCreatoR Posted August 20, 2007 Posted August 20, 2007 Hi all,Again my problem is around the ListView controls (what can i say/do, i love it and that's it )...I have notice that there is no(?) actualy function/method to get the currently focused (not selected) item, something like _GuiCtrlListViewGetItemFocuse() will be greate!I need to "remember" the last focused item (index of it) before i do some stuff with them (these "stuff" involves selection of items etc.), and then i need to set the focus back (for that one i can use _GUICtrlListViewSetItemSelState()).Is it possible?Thanks. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
zmp Posted August 20, 2007 Posted August 20, 2007 This is a direct copy/paste from the MANUAL... you might want to read it throughly mate.expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> Opt ('MustDeclareVars', 1) Dim $listview, $Btn_Exit, $msg, $Status, $pos, $current GUICreate("ListView Get Hot Item", 392, 322) $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER)) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT) GUICtrlCreateListViewItem("line1|data1|more1", $listview) GUICtrlCreateListViewItem("line2|data2|more2", $listview) GUICtrlCreateListViewItem("line3|data3|more3", $listview) GUICtrlCreateListViewItem("line4|data4|more4", $listview) GUICtrlCreateListViewItem("line5|data5|more5", $listview) $Btn_Exit = GUICtrlCreateButton("Exit", 150, 260, 70, 30) $Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER)) $current = _GUICtrlListViewGetHotItem ($listview) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case Else $pos = GUIGetCursorInfo() If ($pos[4] == $listview) Then If ($current <> _GUICtrlListViewGetHotItem ($listview) And _GUICtrlListViewGetHotItem ($listview) >= 0) Then GUICtrlSetData($Status, "Hot Item: " & _GUICtrlListViewGetHotItem ($listview)) $current = _GUICtrlListViewGetHotItem ($listview) ElseIf (_GUICtrlListViewGetHotItem ($listview) == -1) Then GUICtrlSetData($Status, "") EndIf EndIf EndSelect WEnd Exit I code bots :: Need a bot? :: xythec@gmail.com
martin Posted August 20, 2007 Posted August 20, 2007 (edited) Hi all,Again my problem is around the ListView controls (what can i say/do, i love it and that's it )...I have notice that there is no(?) actualy function/method to get the currently focused (not selected) item, something like _GuiCtrlListViewGetItemFocuse() will be greate!I need to "remember" the last focused item (index of it) before i do some stuff with them (these "stuff" involves selection of items etc.), and then i need to set the focus back (for that one i can use _GUICtrlListViewSetItemSelState()).Is it possible?Thanks._GUICtrlListViewGetCurSel returns the selected item whether the control has focus or not. But maybe I'm not understanding what you're asking.The hot item (in previous post) is just the one under the cursor. Edited August 20, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
MrCreatoR Posted August 20, 2007 Author Posted August 20, 2007 Thanks guys, but i need the focused item, not hovered and not selected, just focused._GUICtrlListViewGetCurSel returns the selected item whether the control has focus or notWell i need to check if it has focus, whether the control has selection or not Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
ReFran Posted August 20, 2007 Posted August 20, 2007 (edited) "..I have notice that there is no(?) actualy function/method to get the currently focused (not selected) item, something like _GuiCtrlListViewGetItemFocuse() will be greate! ... " Seems to become a quiz game, or? Also if I think it doesn't help you very much. Direkt from Auto3Lib help: _ListView_GetItemFocused. Perhaps you describe simple what you want to do. It seems not to be clear, what you understand under focus in a listview. br, Reinhard Edited August 20, 2007 by ReFran
MrCreatoR Posted August 20, 2007 Author Posted August 20, 2007 Direkt from Auto3Lib help: _ListView_GetItemFocusedThanks, but this func check if some known item has focus, and i need to check unknown item (return the one that focused).Perhaps you describe simple what you want to doI want to be able select and then unselect items, but preserve the focus of the last selected (by user) item.what you understand under focus in a listviewThis: Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Zedna Posted August 20, 2007 Posted August 20, 2007 (edited) Next time make some more inventive, Auto3Lib is good start point:Func _ListView_FindFocused($hList) for $iI = 0 to _ListView_GetItemCount($hList) - 1 If _ListView_GetItemFocused($hList, $iI) Then Return $iI next Return -1 EndFunc Edited August 20, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
MrCreatoR Posted August 21, 2007 Author Posted August 21, 2007 Thanks Zedna, i have think about this method to, but it slowing down a litle my script (part of it), there is also 3 more loops... but i will try to combain them somehow.Thanks again! Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
ReFran Posted August 21, 2007 Posted August 21, 2007 (edited) If you work with WM-Notify (LV-onclick) you could save the selected, then you have always the last selected(focused) item. Good luck, Reinhard Edited August 21, 2007 by ReFran
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now