Jump to content

Nothing Special, Just proud of myself


youknowwho4eva
 Share

Recommended Posts

It's just a snippit of my master program, so here's some background. I made a program to pull all the information out of a database and insert them into an ini file. I pulled the results into an array. I wasn't looking forward to making my gui display all 87 records. So I was determined to do it with arrays. And this is what I made. I think it's a great example for anyone else that has a daunting task of programing ahead of them. This displays all 87 records in my gui. And I can pull them back out fairly easily cause I make another array in it that is the input boxes. Yes I know not that great. But, I'm proud so I thought I would share.

For For $n = 1 to 21 Step +1
        GUICtrlCreateLabel($molddetails[$n][0] & ":" ,20,($n * 25) - 15,100,20)
    $res[$n] = GUICtrlCreateInput($molddetails[$n][1],100,($n * 25) - 20,150,20)
Next
For $n = 22 to 42 Step +1
        GUICtrlCreateLabel($molddetails[$n][0] & ":" ,260,(($n - 21) * 25) - 15,100,20)
        $res[$n] = GUICtrlCreateInput($molddetails[$n][1],340,(($n - 21) * 25) - 20,150,20)
    Next
    For $n = 43 to 63 Step +1
        GUICtrlCreateLabel($molddetails[$n][0] & ":" ,500,(($n - 42) * 25) - 15,100,20)
        $res[$n] = GUICtrlCreateInput($molddetails[$n][1],580,(($n - 42) * 25) - 20,150,20)
    Next
    For $n = 64 to $molddetails[0][0] Step +1
        GUICtrlCreateLabel($molddetails[$n][0] & ":" ,740,(($n - 63) * 25) - 15,100,20)
        $res[$n] = GUICtrlCreateInput($molddetails[$n][1],820,(($n - 63) * 25) - 20,150,20)
    Next

Giggity

Link to comment
Share on other sites

I didn't test this but you could simply it to this (or something like this):

For $x = 20 to $molddetails[0][0] Step 240
    For $n = 1 to 64 Step +1
        GUICtrlCreateLabel($molddetails[$n][0] & ":" ,$x,($n * 25) - 15,100,20)
        $res[$n] = GUICtrlCreateInput($molddetails[$n][1],$x + 80,($n * 25) - 20,150,20)
    Next
Next
Edited by Achilles
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

If my thinking is right, that wouldn't come out right. that would give you 4 rows of 64 items, each row being identical. now if it was.

For $x = 20 to 740 Step 240
    For $r = 1 to 4 step +1
        For $n = 1*$r to 21*$r Step +1
            GUICtrlCreateLabel($molddetails[$n*$r][0] & ":" ,$x,($n * 25) - 15,100,20)
            $res[$n*$r] = GUICtrlCreateInput($molddetails[$n*r][1],$x + 80,($n * 25) - 20,150,20)
        Next   
    Next
Next

Edit: I don't think thats right either but it's getting closer

Edited by youknowwho4eva

Giggity

Link to comment
Share on other sites

If my thinking is right, that wouldn't come out right. that would give you 4 rows of 64 items, each row being identical. now if it was.

For $x = 20 to 740 Step 240
    For $r = 1 to 4 step +1
        For $n = 1*$r to 21*$r Step +1
            GUICtrlCreateLabel($molddetails[$n*$r][0] & ":" ,$x,($n * 25) - 15,100,20)
            $res[$n*$r] = GUICtrlCreateInput($molddetails[$n*r][1],$x + 80,($n * 25) - 20,150,20)
        Next   
    Next
Next

Edit: I don't think thats right either but it's getting closer

Oh yeah, you're right. I had something different and then I changed it. But you could get it to work. I'll try it again...

Edit: It would be too confusing for it to be useful. Anyways, good work on using arrays. It took me awhile to figure how they worked but now they seem simple.

Edited by Achilles
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...