Sign in to follow this  
Followers 0
Jochem

GUICtrlSetTip with array

5 posts in this topic

I want to create a tool tip for many pictures, but my script isn't working :)

$folder = "\\server\log\"
$arrayuse = _FileListToArray($folder, "*")

#Region ### START Koda GUI section ### Form=C:\Data\au\computer issues\adobe\1computer.kxf
$adobe_1_1 = GUICreate("search adobe", 259, 66, 550, 213)
$picc88 = GUICtrlCreatePic("imac_free.jpg", 20, 10, 30, 30)
$picc90 = GUICtrlCreatePic("imac_free.jpg", 50, 10, 30, 30)
$picc91 = GUICtrlCreatePic("imac_free.jpg", 80, 10, 30, 30)
$picc92 = GUICtrlCreatePic("imac_free.jpg", 110, 10, 30, 30)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

For $i = $arrayuse[1] To $arrayuse Step 1
    $i2 = StringTrimLeft(StringTrimRight($i, 4), 3)
    GUICtrlSetTip(Eval("$pic" & $i2), "test")
Next

While 1
    Sleep(10)
WEnd
Func CLOSEClicked()
    Exit
EndFunc

the value of a string in the arrayuse is i.e. ws-c91.log Thats why I am trimming the left and right side. I checked already the value $i2 with a messagebox (it gives indeed c91).

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

From the Help File for _FileListToArray:

The array returned is one-dimensional and is made up as follows:
$array[0] = Number of Files\Folders returned
$array[1] = 1st File\Folder
$array[2] = 2nd File\Folder
$array[3] = 3rd File\Folder
$array[n] = nth File\Folder

In your For...Next loop you don't reference the [0] index as the amount to go to.

*Edit - For that matter, there's a lot wrong with the opening line of your For...Next statement. Try this instead:

For $i = 1 To $arrayuse[0]
Edited by exodius

Share this post


Link to post
Share on other sites

*Edit - For that matter, there's a lot wrong with the opening line of your For...Next statement. Try this instead:

For $i = 1 To $arrayuse[0]
but that is giving me one blank line, but oke a changed it like this:

For $i = 1 To $arrayuse Step 1
    $i2 = StringTrimLeft(StringTrimRight($i, 4), 3)
    MsgBox(0,"",$i2)
    GUICtrlSetTip(Eval("$pic" & $i2), "test")
Next

the message box is just a control. I think the eval is not working like this.

Share this post


Link to post
Share on other sites

Remove the dollar sign in the Eval call, call it like this:

Eval('pic' & $i2)

Share this post


Link to post
Share on other sites

Remove the dollar sign in the Eval call, call it like this:

Eval('pic' & $i2)
YES!! thanks, this worked.

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  
Followers 0