Sign in to follow this  
Followers 0
MikelSevrel

Help with For $i = 0 To ...

4 posts in this topic

I'm trying to setup a selection at the beginning of a script based on a file. The string might have something like Monday,Friday in it. But I have trouble with this, here's what I have.

Select
    Case StringInStr($inivar[8][1], "Sunday")
        $1 = 2
            Case StringInStr($inivar[8][1], "Monday")
        $2 = 3
            Case StringInStr($inivar[8][1], "Tuesday")
        $3 = 4
            Case StringInStr($inivar[8][1], "Wednesday")
        $4 = 5
            Case StringInStr($inivar[8][1], "Thursday")
        $5 = 6
            Case StringInStr($inivar[8][1], "Friday")
        $6 = 7
            Case StringInStr($inivar[8][1], "Saturday")
        $7 = 8
    EndSelect
$dates = _ArrayCreate ($1, $2, $3, $4, $5, $6, $7)

For $i = 1 To $dates
    _GUICtrlListViewSetCheckState ($ListView, $i, 1)
Next

Coming soon....

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

#include <GUIConstants.au3>
#include <GuiListView.au3>
Global Const $Cursor_WAIT = 15
Global Const $Cursor_ARROW = 2

GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color

$listview = GUICtrlCreateListView("day of the week", 10, 10, 200, 200);,$LVS_SORTDESCENDING)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_CHECKBOXES, $LVS_EX_CHECKBOXES)
GUICtrlCreateListViewItem("Sunday", $listview)
GUICtrlCreateListViewItem("Monday", $listview)
GUICtrlCreateListViewItem("Tuesday", $listview)
GUICtrlCreateListViewItem("Wednesday", $listview)
GUICtrlCreateListViewItem("Thursday", $listview)
GUICtrlCreateListViewItem("Friday", $listview)
GUICtrlCreateListViewItem("Saturday", $listview)
GUISetState()
Dim $inivar[9][2]
$inivar[8][1] = "Saturday"
_SetDay($listview, $inivar[8][1])

Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func _SetDay(ByRef $lv_days, $t_input)
    Local $found_day = 0, $x
    GUISetCursor($Cursor_WAIT, 1)
    For $x = 0 To _GUICtrlListViewGetItemCount ($lv_days) - 1
        If StringInStr(StringUpper(_GUICtrlListViewGetItemText ($lv_days, $x, 0)), StringUpper($t_input)) Then
            GUICtrlSetState($lv_days, $GUI_FOCUS)
            _GUICtrlListViewSetCheckState ($lv_days, $x)
            $found_day = 1
            ExitLoop
        EndIf
    Next
    GUISetCursor($Cursor_ARROW, 1)
    If Not $found_day Then
        MsgBox(0, "No Match", "Day not found: " & $t_input)
    EndIf
EndFunc  ;==>_SetDay

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Sorry that I wasn't more specific. But, the answers lay within those posts. So thanks.


Coming soon....

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