Jump to content

ListView Item


Recommended Posts

Hi to all, i've another question for you =P

For example i've this code :

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 357, 169, 192, 124)
$listview = GUICtrlCreateListView("Try it", 0, 40, 354, 126)
$Button1 = GUICtrlCreateButton("Previous Item", 8, 8, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Next Item", 96, 8, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlCreateListViewItem("Item1", $listview)
GUICtrlCreateListViewItem("Item2", $listview)
GUICtrlCreateListViewItem("Item3", $listview)
GUICtrlCreateListViewItem("Item4", $listview)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            ;I would like to select the previous listview item
        Case $Button2
            ;I would like to select the next listview item


    EndSwitch
WEnd

If i press button 1 or 2 i would like to select the previos or next listview iteam...how i can do that?

P.S. There is a metod to use an icon like as a button? How?

Thanks to all for support :x

Link to comment
Share on other sites

  • Moderators

StungStang,

Here you go: :x

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiListView.au3>

$hGUI = GUICreate("Test", 360, 170)

$hListView = GUICtrlCreateListView("Try it", 10, 40, 340, 120)
$hButton_Prev = GUICtrlCreateButton("Previous Item", 10, 10, 75, 25)
$hButton_Next = GUICtrlCreateButton("Next Item", 100, 10, 75, 25)

$hButton_Icon = GUICtrlCreateButton("", 200, 10, 25, 25, $BS_ICON)
GUICtrlSetImage(-1, "C:\Program Files\AutoIt3\Icons\au3.ico")

GUISetState(@SW_SHOW)

For $i = 1 To 4
    GUICtrlCreateListViewItem("Item " & $i, $hListView)
Next

_GUICtrlListView_SetItemState($hListView, 0, $LVIS_SELECTED, $LVIS_SELECTED)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_Prev
            _Selector(1)
        Case $hButton_Next
            _Selector()
        Case $hButton_Icon
            MsgBox(0, "Hi!", "I am an icon button!")
    EndSwitch
WEnd

Func _Selector($iCode = 0)

    Local $iCount = _GUICtrlListView_GetItemCount($hListView)
    For $iIndex = $iCode To $iCount + $iCode - 2
        If _GUICtrlListView_GetItemState($hListView, $iIndex, $LVIS_SELECTED) <> 0 Then
            _GUICtrlListView_SetItemState($hListView, $iIndex - (2 * $iCode) + 1, $LVIS_SELECTED, $LVIS_SELECTED)
            ExitLoop
        EndIf
    Next
    GUICtrlSetState($hListView, $GUI_FOCUS)

EndFunc

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

StungStang,

I asked you yesterday if the dog had eaten your Help file - do you ever look at it before posting? :x

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hIcon = GUICtrlCreateIcon("C:\Program Files\AutoIt3\Icons\au3.ico", -1, 10, 10, 25, 25)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hIcon
            MsgBox(0, "Hi!", "I am an icon!")
    EndSwitch
WEnd

Why not try and read a bit of the Help file each night before you go to sleep. It will help reduce the frustration level you feel when you are stuck on simple questions like this. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

mmm im try to get an effect like this...but no one of this function do the same :/

Look that...you think that it was a button?...it don't seems to be, look :

You know witch function to do that? It appareals very good

This is a video dimostration : http://www.megaupload.com/?d=35KTUGOW

I've uploaded on megaupload becaouse youtube aren't working >_>

Hi!

Link to comment
Share on other sites

  • Moderators

StungStang,

The downloaded file does not run, so no-one has any idea what you want. :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

StungStang,

Take a look at the GuiToolbar UDF in the Help file - not exactly the same, but probably as close as you will get in AutoIt. :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@Melba

This "toolbar" was made with autoit, but unfortunately it's closed source, and i cant know what function the user have used...no idea to do the same great effect?

P.S. It's seems to be the same function :x

Thanks for your help...very very good =)

Edited by StungStang
Link to comment
Share on other sites

  • Moderators

StungStang,

Where did you get the compiled AutoIt file? Could you post it here? What does the Window Info tool say about it?

If it came from the forum then we might be able to find out a bit more about it. :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

StungStang,

If it was on a public forum then posting the link here is no problem. :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...