Jump to content

Recommended Posts

Posted (edited)

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
Posted

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

Replace this:

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

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
×
×
  • Create New...