Question :
Shouldn't that be :

 From now on I can retrieve any control by name
(using example 1)

Dim aControl as Editfield

aControl = ControlDict.Value("editfield1").value("control")
Since it looks like ControlDict.Value("editfield1") would be a dictionary.
Or maybe i'm confused here.

As far as I know, both ways of working are valid.
With the code in the open event of the window, you'll have a longer 
startup on openening the window.
With my code I think I'll have a faster startup for the Window but a 
longer lookup for the control.

Alternatively you could not put it in the window open event, but 
initialise the while dictionary when it is first called.
That way you still have the advantages of the dictionary, and a fast 
startup time for the window

Just my 2 cents

Dirk Cleenwerck
Chief Programmer
Useitgroup NV

Bart Pietercil schreef:
> Still feeling a bit green in RB to participate in discussions (for  
> the time being I prefer learning by lurking) like this but what is  
> wrong with this?
>
>
> on Windowlevel create a Dictionary ControlDict
>
> In the windows open event
>
> Dim i as Integer
>
> ControlDict = new Dictionary
>
> For i = 0 to Self.ControlCount-1
>   ControlDict.Value(Self.control(i).name) = Self.control(i)
> Next
>
> you can modify this in order to store more info about the control  
> into the Dict like this
>
> Dim i as integer
>
> ControlDict = new Dictionary
>
> For i = 0 to Self.ControlCount-1
>    Dim aDict as new Dictionary
>    Select Case True
>    case Self.control(i) isa Editfield
>       aDict.Value("controlType") = "Editfield"
>    case ......
>
>    end Select
>    aDict.Value("control") = Self.Control(i)
>    ControlDict.Value(Self.control(i).name) = aDict
> Next
>
>
>  From now on I can retrieve any control by name
> (using example 1)
>
> Dim aControl as Editfield
>
> aControl = ControlDict.Value("editfield1")
>
> aControl.Text = aControl.name
>
> UNTESTED "mail-code"
>
> just to communicate the idea
>
>
> I most certainly would like to know what the disadvantages are of  
> this approach
>
>
> Bart Pietercil
>
>   
>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to