Sign in to follow this  
Followers 0
pl123

Placing arrays in a GUI

7 posts in this topic

#1 ·  Posted (edited)

I need to place an array in a GUI. For example, when this code below finishes executing, I want to place the resulting array in a GUI. Is this possible?

Func _InstalledPrograms ()
    Local $Count = 1
    While 1
        $Key = RegEnumKey ($InstalledProgramRegKey, $Count)
        If Not @error = 0 then ExitLoop
        $Line = RegRead ($InstalledProgramRegKey & '\' & $Key, 'Displayname')
        $Line = StringReplace ($Line, ' (remove only)', '')
        If Not $Line = "" Then
           ; If Not IsDeclared('ProgramArray') Then Dim $ProgramArray[1]
            ReDim $ProgramArray[UBound($ProgramArray) + 1]
            $ProgramArray[0] = UBound($ProgramArray) - 1
            $ProgramArray[UBound($ProgramArray) - 1] = $Line
        EndIf
        $Count = $Count + 1
    WEnd
    Select
        Case IsDeclared('ProgramArray') = 0
            SetError (1)
            Return ('')
        Case IsDeclared('ProgramArray') = 1
            SetError (0)
            Return($ProgramArray)
    EndSelect
EndFunc

EDIT: I want the array to show as a list in the GUI.

Edited by pl123

Share this post


Link to post
Share on other sites



It is possible but you need to be more specific.

- you want it displayed in a list

- create controls for all the elements (buttons, labels, checkboxes...)

- displayed in a treeview

Every way has a different coding but IT IS possible.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Hello pl123,

Try _ArrayDisplay() with the Array.au3 UDF. If that does not suit your needs, than you may want to look into listview functions and the listview UDF. All of which are in your help file.

Realm


My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

enaiman: I think in a list would be best.

Share this post


Link to post
Share on other sites

enaiman: I think in a list would be best.

I don't think that enaiman caught your Edit pl123. Thus his reply was just from before your edit. At first you did'nt specify how you wanted the output to the GUI. Thus he was asking for specifics following up with a few examples. His suggestion of using a TreeView might work as well, all depending on what you need.

Next Time you post for help, try to explain in detail what issue/problem you are having, also in detail what you expect as the final result, and of course and example of the code where you are experiencing an issue/problem(Which you did)

It is alot easier to help someone fix their car, if they tell you what is wrong with it :graduated:

Realm


My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

You didn't have even a short look at the help file - did you?

The answer is straight there:

_GUICtrlListView_AddArray

--------------------------------------------------------------------------------

Adds items from an array to the control

#Include <GuiListView.au3>

_GUICtrlListView_AddArray($hWnd, ByRef $aItems)

... with examples and everything.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Thanks for your help!

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