Jump to content

buggy trouble with list in gui


Recommended Posts

well.. since im sitting here.. getting pissed about another error in another script, and not really getting any answers from anyone....

ill post another problem i had with another script, that nobody helped me with either.

this was from a while back.

im trying to make a list, and i want it so when you click the add to list button,

you get something like this

SET 1:

monkey: xxxx-xxxx-xxxx-xxxx

spank: xxxx-xxxx-xxxx-xxxx

ok that works... but when i try to add another "set" i get unwanted results.

SET 1:

SET 2:

monkey: xxxx-xxxx-xxxx-xxxx

monkey: xxxx-xxxx-xxxx-xxxx

spank: xxxx-xxxx-xxxx-xxxx

spank: xxxx-xxxx-xxxx-xxxx

where it should be

SET 1:

monkey: xxxx-xxxx-xxxx-xxxx

spank: xxxx-xxxx-xxxx-xxxx

SET 2:

monkey: xxxx-xxxx-xxxx-xxxx

spank: xxxx-xxxx-xxxx-xxxx

here is the code... i have changed some of the titles... for comic relief... but the workings of the code are the same.

#include <GUIConstants.au3>




$GUI = GUICreate("my buggy fucking program",560,440)




$set = 0
$a = 0
$b = 0
$c = 0 
$d = 0
$e = 0
$f = 0
$g = 0
$h = 0





GUICtrlCreateLabel ("ENTER poopy 2",  10, 235, 120,20)
GUICtrlCreateLabel ("toilet paper:",  10, 250, 120, 15)

$d1 = GUICtrlCreateInput ( "", 140,  240, 30, 20)
$d2 = GUICtrlCreateInput ( "", 175,  240, 30, 20)
$d3 = GUICtrlCreateInput ( "", 210, 240, 30, 20)
$d4 = GUICtrlCreateInput ( "", 245,240, 30, 20)

$x1 = GUICtrlCreateInput ( "", 140, 280, 30, 20)
$x2 = GUICtrlCreateInput ( "", 175, 280, 30, 20)
$x3 = GUICtrlCreateInput ( "", 210,  280, 30, 20)
$x4 = GUICtrlCreateInput ( "", 245,  280, 30, 20)

guictrlsetlimit($d1,4)
guictrlsetlimit($d2,4)
guictrlsetlimit($d3,4)
guictrlsetlimit($d4,4)
guictrlsetlimit($x1,4)
guictrlsetlimit($x2,4)
guictrlsetlimit($x3,4)
guictrlsetlimit($x4,4)

GUICtrlCreateLabel ("ENTER crap units",  10, 275, 120, 20)
GUICtrlCreateLabel ("totally here:",  10, 290, 120, 15)


GUICtrlCreateLabel ("stuff thats LOADED:",  333, 235, 120,15)   
GUICtrlCreateLabel (" 0",  460, 235, 13,15)  


$add=GUICtrlCreateButton ("Add it To List",  165, 315, 85)


$mylist=GUICtrlCreateList ("", 333,270,200,130)

GUICtrlSetLimit(-1,200) 


$clear=GUICtrlCreateButton ("Clear Last entry", 333, 400, 75)
$install=GUICtrlCreateButton ("Install list", 464,400,70)


GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()

    Select
         case $msg = $add
        $i = GUICtrlRead($d1)
        $j = GUICtrlRead($d2)
        $k = GUICtrlRead($d3)
        $l = GUICtrlRead($d4)
        $m = GUICtrlRead($x1)
        $n = GUICtrlRead($x2)
        $o = GUICtrlRead($x3)
        $p = GUICtrlRead($x4)
$set = $set + 1
$a = 0
$b = 0
$c = 0 
$d = 0
$e = 0
$f = 0
$g = 0
$h = 0
        GUICtrlSetData($mylist,"                 SET " & $set & ":")
        GUICtrlSetData($mylist,"monkey: " & $i & "-" & $j & "-" & $k & "-" & $l)
        GUICtrlSetData($mylist,"spank: " & $m & "-" & $n & "-" & $o & "-" & $p)
        

GUICtrlSetData($d1,"")
GUICtrlSetData($d2,"")
GUICtrlSetData($d3,"")
GUICtrlSetData($d4,"")
GUICtrlSetData($x1,"")
GUICtrlSetData($x2,"")
GUICtrlSetData($x3,"")
GUICtrlSetData($x4,"")

$msg = 0




         case $msg = $clear
        GUICtrlSetData($mylist,"")
         Case $msg = $install
            MsgBox(0,"", "the closing button has been clicked",2)
            Exit
        EndSelect
        

        $var1 = stringlen (GuiCtrlRead($d1))  
        $var2 = stringlen (GuiCtrlRead($d2))
        $var3 = stringlen (GuiCtrlRead($d3))
        $var4 = stringlen (GuiCtrlRead($d4))
        $var5 = stringlen (GuiCtrlRead($x1))
        $var6 = stringlen (GuiCtrlRead($x2))
        $var7 = stringlen (GuiCtrlRead($x3))
        $var8 = stringlen (GuiCtrlRead($x4))
        
                    If $var1 = 4 And $var2 = 4 And $var3 = 4 And $var4 = 4 _
        And $var5 = 4 And $var6 = 4 And $var7 = 4 And $var8 = 4 And Not ControlCommand($GUI,"",$add,"IsEnabled") Then
        GuiCtrlSetState($add, $GUI_ENABLE)
        
    ElseIf $var1 <> 4 And $var2 <> 4 And $var3 <> 4 And $var4 <> 4 And $var5 <> 4 And _
        $var6 <> 4 And $var7 <> 4 And $var8 <> 4 And ControlCommand($GUI,"",$add,"IsEnabled") Then
        GuiCtrlSetState($add, $GUI_DISABLE)
    EndIf



                    If $var1 = 4 And $var2 = 4 And $var3 = 4 And $var4 = 4 _
        And $var5 = 4 And $var6 = 4 And $var7 = 4 And $var8 = 4 And Not ControlCommand($GUI,"",$clear,"IsEnabled") Then
        GuiCtrlSetState($clear, $GUI_ENABLE)
        
    ElseIf $var1 <> 4 And $var2 <> 4 And $var3 <> 4 And $var4 <> 4 And $var5 <> 4 And _
        $var6 <> 4 And $var7 <> 4 And $var8 <> 4 And ControlCommand($GUI,"",$clear,"IsEnabled") Then
        GuiCtrlSetState($clear, $GUI_DISABLE)
    EndIf
    
    
    
    
                        If $var1 = 4 And $var2 = 4 And $var3 = 4 And $var4 = 4 _
        And $var5 = 4 And $var6 = 4 And $var7 = 4 And $var8 = 4 And Not ControlCommand($GUI,"",$install,"IsEnabled") Then
        GuiCtrlSetState($install, $GUI_ENABLE)
        
    ElseIf $var1 <> 4 And $var2 <> 4 And $var3 <> 4 And $var4 <> 4 And $var5 <> 4 And _
        $var6 <> 4 And $var7 <> 4 And $var8 <> 4 And ControlCommand($GUI,"",$install,"IsEnabled") Then
        GuiCtrlSetState($install, $GUI_DISABLE)
    EndIf
    
    
    
    


            


            If $var1 = 4 and $a = 0 Then
                send("{tab}")
                $a = 1
            EndIf
            
            If $var2 = 4 and $b = 0 Then
                send("{tab}")
                $b = 1
            EndIf

            If $var3 = 4 and $c = 0 Then
                send("{tab}")
                $c = 1
            EndIf
            
            If $var4 = 4 and $d = 0 Then
                send("{tab}")
                $d = 1
            EndIf
            
            If $var5 = 4 and $e = 0 Then
                send("{tab}")
                $e = 1
            EndIf
            
            If $var6 = 4 and $f = 0 Then
                send("{tab}")
                $f = 1
            EndIf
            
            If $var7 = 4 and $g = 0 Then
                send("{tab}")
                $g = 1
            EndIf
            
                        If $var8 = 4 and $h = 0 Then
                send("{tab}")
                $h = 1
            EndIf
            
        
    
Wend

wellllll.. thats it in its entirety. if ya wanna look at it maybe tweak it.. heh

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

  • Developers

well.. since im sitting here.. getting pissed about another error in another script, and not really getting any answers from anyone....

ill post another problem i had with another script, that nobody helped me with either.

<{POST_SNAPBACK}>

stopped reading here ... calling me a nobody ?

maybe you should stop scripting and go back to play with Lego.....

ok .. one hint... Add a | at the start of the value of the first GUICtrlSetData().....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

the problem is $LB_SORT for default style. Took it out in the code I posted.

But have to agree with jdeB with the names.

Also check your ControlCommand function calls, all have invalid number of params, need to add ,"" to end of params passed, read the help on ControlCommand

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • Developers

the problem is $LB_SORT for default style. Took it out in the code I posted.

But have to agree with jdeB with the names.

Also check your ControlCommand function calls, all have invalid number of params, need to add ,"" to end of params passed, read the help on ControlCommand

<{POST_SNAPBACK}>

You can see how distracted i got with the first part...

I thought that the list had to be replaced in stead of not sorted.....

Note to self: next time just don't even try when you get distracted by the first few lines... :(

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

hey jdeb, i posted that nobody helping me right before you helped me.. or right before i read that post you made.

sorry!

but anyways.. thanks!

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

wellll. i changed a few things.

but yeah, its just replacing the list now, and not adding to it.

i added that pipe,

i changed the mylist variable to

("", 333,270,200,130, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $WS_TABSTOP))

it took me a while just to make this gui, and im olmost done, but i am a noob to the gui part of autoit still.

one other problem i am having, is after i add a set to the list, the control should be placed back on the first inputbox so the cursor starts there again, and you dont have to click on the box.

what im trying to do shouldnt be as hard as its seeming to be heh.

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

thanks, i got that working now.

but im still having trouble with the list.

it will replace the last entry, instead of adding to it.

this is the last issue im having with this. everything else seems to be working fine

do i still want that pipe in there? im not sure what to do heh...

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

thanks, i got that working now.

but im still having trouble with the list.

it will replace the last entry, instead of adding to it.

this is the last issue im having with this. everything else seems to be working fine

do i still want that pipe in there?  im not sure what to do heh...

<{POST_SNAPBACK}>

I didn't put the pipe in, so it added on my test, not replaced

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

i guess there is one more small thing.. heh

if i want to clear the list, i use

GUICtrlSetData($mylist,"")

how would i go about only clearing the last "set" entered?

i dont want to clear the whole list...

i just want when you click the clear last set button, to clear each entry one at a time for each time you click the clear button, that the user put into the list each time they had clicked the add button.

i would think maybe an array, but im not sure how i would make it.

like $mylist with nothing on it would be array[0]

then i click the add button, the list gets an entry in it,

that would be array[1]

then when i clicked clear, it would know what number you were at, and subtract one every time you clicked the button, reset the data will the whole array, minus the last number for every time you click the button.

just a thought, i dont know how to start making that, but what would you do.. any suggestions?

if this didnt make sense...

pretty much, every time you click add.. you add to the list.

lets say i add 10 things

aaaaa

sssss

ddddd

fffff

ggggg

hhhhh

jjjjj

kkkkk

lllll

;;;;;

now i want to delete them. so i click the "clear last set" button, but i have to hit it 10 times.

so it would look like this... when i click it once

aaaaa

sssss

ddddd

fffff

ggggg

hhhhh

jjjjj

kkkkk

lllll

this twice

aaaaa

sssss

ddddd

fffff

ggggg

hhhhh

jjjjj

kkkkk

this 3 times

aaaaa

sssss

ddddd

fffff

ggggg

hhhhh

jjjjj

get it?

also is there a way to make the list scroll down as you are populating it? so that when it gets full, you can see the entry appear instead of having to scroll down after you have entered it?

lol, just trying to make it perfect.. so far so good! thanks for the help so far.

any more help of course.. is appreciated.

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

If you really want to be able to do alot with a GuiList box, if you don't mind using beta, there's alot of User Defined functions for it.

Or you'll have to do alot of research at msdn on how to get index #'s delete items etc...

Not sure about the auto scroll on Listbox, know it can be done on combo box.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...