Jump to content

Assigning GUICtrlCreateInput handles to array: "Expected a "=" operator in assignment statement.:"


entrapay234
 Share

Recommended Posts

  • Moderators

Abraluna,

Array indices use [ ] not ( ). ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Abraluna,

Works perfectly for me: :)

#include <GUIConstantsEx.au3>

Global $Input[50]
Global $GuiListDisplays[50]
Global $Sites[50]

$Form1_1 = GUICreate("Global Website Blocker", 661, 347, 335, 228)

$PageControl1 = GUICtrlCreateTab(8, 8, 644, 280)
$TabSheet1 = GUICtrlCreateTabItem("Input Block Sites ")
$Input[0] = GUICtrlCreateInput($GuiListDisplays[0], 16, 40, 121, 22)
$Input[1] = GUICtrlCreateInput($GuiListDisplays[1], 16, 64, 121, 22)
$Input[2] = GUICtrlCreateInput($GuiListDisplays[2], 16, 88, 121, 22)
$Input[3] = GUICtrlCreateInput($GuiListDisplays[3], 16, 112, 121, 22)
$Input[4] = GUICtrlCreateInput($GuiListDisplays[4], 16, 136, 121, 22)
GUICtrlCreateTabItem("")

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

And you might want to look at using a loop to create the inputs - it will save a lot of typing. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Braluna,

And your full source also works - and this version shows how to use the loops too: ;)

#include <GUIConstantsEx.au3>

Global $Input[50]
Global $GuiListDisplays[50]
Global $Sites[50]
Global $SiteListDir
$SiteListDir = @ScriptDir & "SiteLogFile.txt"

$Form1_1 = GUICreate("Global Website Blocker", 661, 347, 335, 228)
$PageControl1 = GUICtrlCreateTab(8, 8, 644, 280)
$TabSheet1 = GUICtrlCreateTabItem("Input Block Sites ")
For $i = 0 To 9
    For $j = 0 To 4
        $iItem = ($j * 10) + $i
        $Input[$iItem] = GUICtrlCreateInput($GuiListDisplays[$iItem], 16 + (128 * $j), 40 + (22 * $i), 121, 22)
    Next
Next
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("Block Site List", 8, 296, 321, 41)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Save Site List", 360, 296, 145, 41)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Load Site List", 504, 296, 145, 41)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            FuncBlockSites()
        Case $Button2
            FuncSaveSiteList()
        Case $Button3
            FuncLoadSiteList()
    EndSwitch
WEnd

Func FuncBlockSites()
    MsgBox(1, "", "Block Sites")
EndFunc   ;==>FuncBlockSites

Func FuncSaveSiteList()
    MsgBox(1, "", "Save Site List")
EndFunc   ;==>FuncSaveSiteList

Func FuncLoadSiteList()
    MsgBox(1, "", "Load Site List")
EndFunc   ;==>FuncLoadSiteList

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Abraluna,

Don't know why it'd result in that specific error though

It is because AU3Check is a single pass check and sometimes errors when faced with something which is the result of an earlier error that was not immediately apparent. In this case I imagine it carried on looking for that missing EndIf and then errored at the first thing which made no sense afterwards. If you get one of these obscure errors then I suggest running Tidy - it looks for structure errors, not syntax ones, and so can provide valuable clues. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Abraluna,

if you load/save/load/save over and over again it raises by 1

It is because _FileReadToArray sets the [0] element to a count - so you need to read from 1 To 50 and not 0 To 49: ;)

Func FuncLoadSiteList()
    $file = FileOpen($SiteListDir, 1)
    _FileReadToArray($SiteListDir, $Sites)
    For $i = 1 To 50
        GUICtrlSetData($Input[$i - 1], $Sites[$i])
    Next
EndFunc   ;==>FuncLoadSiteList

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Abraluna,

If you want the inputs to have a "down and across" tab order then you need to adjust the algorithm: ;)

For $i = 0 To 4
    For $j = 0 To 9
        $iItem = ($i * 10) + $j
        $Input[$iItem] = GUICtrlCreateInput($GuiListDisplays[$iItem], 16 + (128 * $i), 40 + (22 * $j), 121, 22)
    Next
Next

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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