Sign in to follow this  
Followers 0
marko001

Hide Inputbox until filled

4 posts in this topic

Hi all,

i used array to create several inputboxes:

Func _create_Resources_Input()
    $Alto = 165
    $Sinistra = 176
    $delta = 0
    $multiplier = 0
    local $a, $
    For $t = 0 To 24
        For $a = 0 To 5
            $InputRES[$t][$a] = GUICtrlCreateInput("", $Sinistra + $delta * $multiplier, $Alto, 50, 21, BitOR($ES_READONLY,$ES_CENTER))
            $delta = 55
            $multiplier = $multiplier + 1
        Next
        $Alto = $Alto + 25
        $delta = 0
        $multiplier = 0
    Next
EndFunc

_create_Resources_Input()

and a function to fill them:

func _showResources()
    for $k = 0 to UBound($Town_ID_Names) -1
        GUICtrlSetData($Resources_InputTowns[$k][0],$Town_ID_Names[$k][1])
        for $i = 0 to UBound($total_res)-1
            if $total_res[$i][0] = $Town_ID_Names [$k][1] Then
                GUICtrlSetData($InputRES[$k][0],$total_res[$i][1])
                GUICtrlSetData($InputRES[$k][1],$total_res[$i][2])
                GUICtrlSetData($InputRES[$k][2],$total_res[$i][3])
                GUICtrlSetData($InputRES[$k][3],$total_res[$i][4])
                GUICtrlSetData($InputRES[$k][4],$total_res[$i][5])
                GUICtrlSetData($InputRES[$k][5],$total_res[$i][6])
;~              GUICtrlSetData($InputRES[$k][6],$total_res[$i][7])
;~              GUICtrlSetData($InputRES[$k][7],$total_res[$i][8])
;~              GUICtrlSetData($InputRES[$k][8],$total_res[$i][9])
;~              GUICtrlSetData($InputRES[$k][9],$total_res[$i][10])
            EndIf
        Next
    Next
EndFunc

_showResources()

In this way at beginning the form is filled with 25 lines of empty inputboxes (it takes a lot and it waste time and memory)

And, moreover, usually not all the lines are filled (25) but just few (4/5). Just in very few cases i will use all the lines (but I don't know it before).

Is there a way to create/fill inputboxes ONLY when running the "show" function? i.e. i don't want to have only 3 lines filled and 22 empty inputboxes.

Note that they must be created inside a tab inside the form not just "somewhere".

Thanks a lot,

Marco

Share this post


Link to post
Share on other sites



What determines how many you need? It looks like wherever that comes from, you have it already before the function is run as "UBound($total_res) - 1". So why create ANY of the controls ahead of time? Create them when you need them, not before, and only as many as you need.

That said, a couple dozen hidden, unused controls do not actually consume much in resources. So it's not a big deal anyway.

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

you right, infact i used now guictrlsetstate(...,$gui_hide) nested in the for...next cycle.

I know how many they are once i read a file, not before.

Anyway using the setstate i have to declare them at beginning anyway.

Problem is, how to declare and show them (in same momnent) in the right tab of the form?

Share this post


Link to post
Share on other sites

None of the code you've shown references any form or tab, so I don't know what you mean by that.

Can you post a short demo script that creates a simplified GUI showing your issue?

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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