Jump to content
Sign in to follow this  
ciffer

Child gui with input thingy

Recommended Posts

ciffer

Hi!

I am making a script which will show mouse pos and also color (normal and in hex). All that information is stored in ListViewItems. The only problem is 1st column, also known as Name (variable $nazwa). I want to make a little child gui window with input so i can put that name there. But i don't know how ._. Can anyone help me?

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("Hello World", 800, 400)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUICtrlSetOnEvent($okbutton, "OKButton")
$posmysz = MouseGetPos()
GUISetState(@SW_SHOW)
$lista = GUICtrlCreateListView("Nazwa|Pozycja X|Pozycja Y|Kolor|Kolor Hex|", 300, 100, 400, 200)
$kolor = 0
$kolor_hex = 0
$nazwa = ">.<"



While 1
    Sleep(500)
    $posmysz = MouseGetPos()
    GUICtrlCreateLabel("X=" & $posmysz[0] & "   Y=" & $posmysz[1], 80, 10)
WEnd

Func OKButton()
    $posmysz = MouseGetPos()
    MsgBox(0, "GUI Event", "Umieć mysz nad pikselem i nacinij enter")
    Kolor($posmysz[0], $posmysz[1])
      ;Func Kolor is looking and writing information about colors. That is why i want that window here
    $nazwa = GUICtrlCreateInput("Wprowadź nazwę", 10, 10)
    GuiCtrlCreateListViewItem($nazwa & "|" & $posmysz[0] & "|" & $posmysz[1] & "|" & $kolor & "|" & $kolor_hex, $lista)
EndFunc  ;==>OKButton

Func CLOSEClicked()
    Exit
EndFunc  ;==>CLOSEClicked

Func Kolor ($posx, $posy)
    $kolor = PixelGetColor($posx, $posy)
    $kolor_hex = hex($kolor)
    EndFunc
Edited by ciffer

Share this post


Link to post
Share on other sites
newbiescripter

I know it isn't the question, but Insted of using the OK button. then create a Hotkey because else you can only get the color of different places in the OK button.. :)

Regards

Share this post


Link to post
Share on other sites
ciffer

Nope ;] You can use enter to press OK in dialog box ;]

Share this post


Link to post
Share on other sites
newbiescripter

You're right :)

but use for example:

HotKeySet("{F4}","OKButton")

When you get more buttons in your script then I think it's a bit easier for the client :(

Share this post


Link to post
Share on other sites
covaks

How about using a simple InputBox instead of an Input control? eg:

Replace this:

$nazwa = GUICtrlCreateInput("Wprowadź nazwę", 10, 10)oÝ÷ Ùh­Øb±«­¢+ØÀÌØí¹éÝô%¹ÁÕÑ   ½à ÅÕ½Ðí]ÁɽÝè¹éÝÅÕ½Ðì°ÅÕ½Ðí]ÁɽÝè¹éÝÅÕ½Ðì¤

Share this post


Link to post
Share on other sites
ciffer

Great! Just as i wanted to ;] Thanks ;]

Share this post


Link to post
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
Sign in to follow this  

×