Jotos Posted August 5, 2023 Posted August 5, 2023 (edited) Heya, I want to create Labels with a For-Next loop, to show all my used HotKeys. But it dont show the names in the labels.. This is my code so far: Local $Label[4] Local $funktion[5] $funktion[1] = "Function1" $funktion[2] = "Function2" $funktion[3] = "Function3" $funktion[4] = "Function3" HotKeySet("{1}", "Function1") HotKeySet("{2}", "Function2") HotKeySet("{3}", "Function3") HotKeySet("{4}", "Function3") For $i = 0 To 3 $arraySlot = $i+1 $Label[$i] = GUICtrlCreateLabel($i+1 & ": " & $funktion[$arraySlot], 16, 8+14*$i, 36, 17) Next The result is: Edited August 5, 2023 by Jotos
Solution ahmet Posted August 5, 2023 Solution Posted August 5, 2023 Try increasing width of your labels. Also when posting code try to post runnable snippet.
Andreik Posted August 5, 2023 Posted August 5, 2023 What about giving them enough space to be displayed. 36 pixles is not enough. $Label[$i] = GUICtrlCreateLabel($i+1 & ": " & $funktion[$arraySlot], 16, 8+14*$i, 100, 17)
Jotos Posted August 5, 2023 Author Posted August 5, 2023 Just now, Andreik said: What about giving them enough space to be displayed. 36 pixles is not enough. $Label[$i] = GUICtrlCreateLabel($i+1 & ": " & $funktion[$arraySlot], 16, 8+14*$i, 100, 17) Its not the display - i try to dispaly the array not the STRING inside of the array. I have to use _ArrayToString, I think.
Andreik Posted August 5, 2023 Posted August 5, 2023 You are confuse about what are you trying to achieve. How can you display the array and not the content of array?
Jotos Posted August 5, 2023 Author Posted August 5, 2023 (edited) For $i = 0 To 3 $arraySlot = $i+1 $Label[$i] = GUICtrlCreateLabel($i+1 & ": " & _ArrayToString($funktion, @TAB, $i+1, $i+1), 16, 8+14*$i, 36, 17) Next I don't know how to represent the contents of the array $funktion as a string. Edit: you all are right! I didn't understand what the point was at first. .... I am sorry. Edited August 5, 2023 by Jotos
jchd Posted August 6, 2023 Posted August 6, 2023 In AutoIt functions are first-class citizens (they have their own datatype). Your code can be simpler, self-contained and correct: GUICreate("") GUISetState(1) Local $funktion = [Function1, Function2, Function3, Function4] Local $Label[UBound($funktion)] For $i = 0 To UBound($funktion) - 1 HotKeySet($i + 1, $funktion[$i]) $Label[$i] = GUICtrlCreateLabel($i + 1 & ": " & FuncName($funktion[$i]), 16, 8+14*$i, 100, 17) Next Sleep(10000) Func function1() EndFunc Func function2() EndFunc Func function3() EndFunc Func function4() EndFunc This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now