Tuesday, September 20, 2011

Dynamic entry!

Dynamic programming, is the base of all code evolution
It is what made us the best programmers on the planet
Sometime, Dynamic programming take a big leap in evolution...

But you have to use it first!

So to create our control button in internet explorer, in left frame, we use dynamic programming
Is it a new science? Not at all. Simply a good organisation of variable

first we create the arrays:


    Public ARABUTNAM(0) As String
    Public ARABUTDES(0) As String
    Public ARADEPNAM(0) As String
    Public ARADEPCOL(0) As String

Then we fill them dynamically (that can be expanded to infinite)


        X = 0
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "symptomssearch"
        ARABUTDES(X) = "Problem search"
        ARADEPNAM(X) = "SEARCH"
        ARADEPCOL(X) = "cccccc"

        X = X + 1
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "causessearch"
        ARABUTDES(X) = "Causes search"
        ARADEPNAM(X) = "SEARCH"
        ARADEPCOL(X) = "cccccc"

        X = X + 1
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "componentssearch"
        ARABUTDES(X) = "Components Search"
        ARADEPNAM(X) = "SEARCH"
        ARADEPCOL(X) = "cccccc"


        X = X + 1
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "clrframes"
        ARABUTDES(X) = "Clear Frames"
        ARADEPNAM(X) = "OTHER"
        ARADEPCOL(X) = "cccccc"

        X = X + 1
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "info"
        ARABUTDES(X) = "Information/Help"
        ARADEPNAM(X) = "OTHER"
        ARADEPCOL(X) = "cccccc"


        X = X + 1
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "quit01"
        ARABUTDES(X) = "Quit"
        ARADEPNAM(X) = "All"
        ARADEPCOL(X) = "cccccc"

So, we have:
the button name (sub to be called when button is pressed)
the description (text inside button)
the category or departement (simply to group button of same kind)
the departement color (category color)





as all arrays are expanded everytime we add an element, it's dynamic
If you copy past a group of lines that define a button and change the name and description you can add a control button in my web interface

the add the condition to execute the code

adding:


        X = X + 1
        ReDim Preserve ARABUTNAM(X) : ReDim Preserve ARABUTDES(X) : ReDim Preserve ARADEPNAM(X) : ReDim Preserve ARADEPCOL(X)
        ARABUTNAM(X) = "test"
        ARABUTDES(X) = "test multiple buttons"
        ARADEPNAM(X) = "test"
        ARADEPCOL(X) = "cccccc"
'=== sub to draw html buttons in left frame

'=== sub to open internet explorer, define 3 frame and define event for quit, and button press to call subs to 'change a public variable button called differently for each frame


'=== main loop

        Do

            If resbutlefstr = "test" Then
               msgbox("test"
            end if
        Loop Until bReady Or resbutlefstr = "quit01"


Of course we have a web event that will execute code to change the value of resbutlef when a button is pressed in internet explorer frame

bready was there if the user close internet explorer
but i changed it to an event that execute this sub if internet explorer is closed:


    Private Sub oIE_onQuit()
        'bReady = True
        '=== if internet explorer is closed, we exit the program
        End '(end program)
    End Sub

If you fix all array length and define buttons name, you could not add buttons
The frame number is a fixed number
the elements in the frame can be infinite (big database)
so we will display them 15 at one time, with a next button and previous
Also a search button

That will lead us to dymanic sql query building





No comments:

Post a Comment