Jump to content

using arrow keys


 Share

Recommended Posts

Hello.

Can someone help me. On the below example I would like to be able to press the arrow keys and when the key pressed, it will popup a window which is the same as the $button.

Also I have include send("{DOWN}") to make the blue bar show in the list. Is there another better way to make the bar show?

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)

GUISetBkColor (0x00E0FFFF) ; will change background color

$listview = GUICtrlCreateListView ("col1 |col2|col3 ",10,10,200,150);,$LVS_SORTDESCENDING)

$button = GUICtrlCreateButton ("Value?",75,170,70,20)

$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)

$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)

$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)

$input1=GUICtrlCreateInput("",20,200, 150)

GUISetState()

send("{DOWN}")

Do

$msg = GUIGetMsg ()

Select

Case $msg = $button

MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)

Case $msg = $listview

MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)

EndSelect

Until $msg = $GUI_EVENT_CLOSE

Link to comment
Share on other sites

Hi,

hope that helps

#include <GUIConstants.au3>
#include <Misc.au3>

$dll = DllOpen("user32.dll")

$GUI = GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color

$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
$item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) 
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
$input1 = GUICtrlCreateInput("", 20, 200, 150)
GUISetState()
send("{DOWN}")

Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $button
            MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
        Case $msg = $listview
            MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
    EndSelect
    If _IsPressed("27", $dll) Then
        MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
    EndIf
Until $msg = $GUI_EVENT_CLOSE

DllClose($dll)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

He wants to change the Send command to another easier command to show the "bar"

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Link to comment
Share on other sites

  • Moderators

He wants to change the Send command to another easier command to show the "bar"

There were 2 questions there, one th.meger answered with _IsPressed() (Key down), the other about send could be ControlSend($GUI, '', $listview, "{DOWN}") (Naming GUICreate = $GUI), and I'm sure it could be done with GUICtrlSendMsg() but I haven't figured it out yet.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi th.meger, your code don't seems to be any different to mine.

I am still hoping someone could help out on using arrow keys to get the value.

Hi,

have you tried my code? There is a difference!

Have al ook here :

If _IsPressed("27", $dll) Then
        MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
    EndIf

and so on

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

have you tried my code? There is a difference!

A difference in code but the program doesn't have any difference. My question was "I have include send("{DOWN}") to make the blue bar show in the list. Is there another better way to make the bar show?" You added in additional codes which I have no idea what they achieves because the blue bar will not show when I remove the send("{DOWN}") function. Your retain of the send("{DOWN}") is no different to my code.

Link to comment
Share on other sites

A difference in code but the program doesn't have any difference. My question was "I have include send("{DOWN}") to make the blue bar show in the list. Is there another better way to make the bar show?" You added in additional codes which I have no idea what they achieves because the blue bar will not show when I remove the send("{DOWN}") function. Your retain of the send("{DOWN}") is no different to my code.

Hi,

right. I don't know a better way of showing the blue bar. I tried to answer your first question.

This one.

Can someone help me. On the below example I would like to be able to press the arrow keys and when the key pressed, it will popup a window which is the same as the $button.

So, I implemented showing it by pressing the right arrow key.

So long,

Mega

PS: Sorry for misunderstood you.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

right. I don't know a better way of showing the blue bar. I tried to answer your first question.

This one.

So, I implemented showing it by pressing the right arrow key.

So long,

Mega

PS: Sorry for misunderstood you.

Sorry but I tried the code. There is nothing special. It never pop anything when I use the arrow keys. Which is why I said nothing different. Anyway thanks for trying. I managed to solve it by using hotkeyset and controlsend.

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...