Sign in to follow this  
Followers 0
DarkNecromancer

array problems

5 posts in this topic

I'm trying to create a 27 element array but the _array stuff says it only supports up to 21. So i tryed to do it by hand.

Global $msgcache0, $msgcache1, $msgcache2, $msgcache3, $msgcache4, $msgcache5, $msgcache6, $msgcache7, $msgcache8, $msgcache9, $msgcache10, $msgcache11, $msgcache12, $msgcache13, $msgcache14, $msgcache15, $msgcache16, $msgcache17, $msgcache18, $msgcache19, $msgcache20,$msgcache21, $msgcache21, $msgcache22, $msgcache23, $msgcache24, $msgcache25, $msgcache26, $msgcache27
$msgcache0 = 0
Func Display($text)
    If $msgcache0 < 27 Then
        $msgcache($msgcache0 + 1) = $text
        $msgcache0 = $msgcache + 1
    else
    $i = 1
    While $i < 26
        $msgcache($i) = $msgcache($i + 1)
    Wend
    $temp = ""
    For $i = 0 To 27
        $temp = ($temp & @CRLF & $msgcache($i))
    Next
    EndIf
GuiCtrlSetData ( $msgbox, $temp )
EndFunc
Ok so it doesn't like the $msgcache( part, it wants there to be a solid value. Anyone know any way around this?

This all arose because I am having an edit box display the actions of the program, and when it reachs the hight of the edit, it scrolls but stays at the top, i have added $ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL but it still doesn't scroll. So if you guys have any ideas on either it would be very helpful

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you have one of the latest beta's there is a function called _GUICtrlEditScroll() which enables you to scroll the text vertically in a multiline edit control.

Edit: As for the array's you need to use the correct "[]" brackets. Try this, it may be off because I dont fully understand your current syntax of what the array is doing.

Dim $MsgCache[28]; It's 28 because [0] is counted as the first index and 27 as the last

Func Display($Text)
    If $MsgCache[0] < 27 Then
        $MsgCache[$MsgCache[0] + 1] = $Text
        $MsgCache[0] = $MsgCache + 1; Not sure about part after = sign
    Else
;----------------
        $I = 1
        While $I < 26
            $MsgCache[$I] = $MsgCache[$I + 1]
        Wend
;----------------; Will never break out of the above loop because the value of $I never changes
        $Temp = ""
        For $I = 0 To 27
            $Temp = $Temp & @CRLF & $MsgCache[$I]
        Next
    EndIf
    GUICtrlSetData ($MsgBox, $Temp)
EndFunc
Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

I remembered that split made an array so i tryed doing it with that:

Func Display($text)
    $msgcache = ($msgcache & $text);
    $temp = StringSplit ( $msgcache, "@CRLF" )
    For $i = 0 To 27
        $h = ($i + 1)
        $temp[$i] = $temp[$h]
    Next
    $temp[27] = $text
    $msgcache = ""
    For $i = 0 To 27
        $msgcache = ($msgcache & $temp[$i])
    Next
    GuiCtrlSetData ( $msgbox, $temp )
EndFunc

but it complained about the $h saying that it "has incorrect number of subscripts or subscipt dimension range exceeded"

Share this post


Link to post
Share on other sites

Thanks, Ill change it

Share this post


Link to post
Share on other sites

Thanks alot the Pagedown function works perfect, im so fried right now, been programming all day only stopping for lunch and bathroom.... makes me wonder what else is wrong......

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