Jump to content

overlaping GUI labels


Recommended Posts

how do i get rid o a label befire making a new one? when I run this script (), the first label works fine, but all the others are on top of the first one, so theyre unreadable.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

how do i get rid o a label befire making a new one? when I run this script (), the first label works fine, but all the others are on top of the first one, so theyre unreadable.

#region GUI
Global Const $GUI_EVENT_CLOSE           = -3
GUICreate ( "Random Excuse Generator" )
GUISetState(@SW_SHOW)
$button = GUICtrlCreateButton ( "Create New Random Excuse", 10, 60 )
$excuse = GUICtrlCreateLabel ( "I'd love to (insert unpleasant task here), but I have to " , 10, 30 )
new()

GUISetState()

Do
    $msg = GUIGetMsg()
    If $msg = $button Then new()
Until $msg = $GUI_EVENT_CLOSE

Func randomize($type)
    If $type = "v" Then
    $excuse1 = Random (1, 20, 1)
    Switch $excuse1
    Case 1
        $excuse1="eat"
    Case 2
        $excuse1="drink"
    Case 3
        $excuse1="attack"
    Case 4
        $excuse1="notify"
    Case 5
        $excuse1="materialize"
    Case 6
        $excuse1="infuriate"
    Case 7
        $excuse1="immobilize"
    Case 8
        $excuse1="rip"
    Case 9
        $excuse1="dry"
    Case 10
        $excuse1="call"
    Case 11
        $excuse1="run over"
    Case 12
        $excuse1="curse"
    Case 13
        $excuse1="break"
    Case 14
        $excuse1="smash"
    Case 15
        $excuse1="kiss"
    Case 16
        $excuse1="attract"
    Case 17
        $excuse1="plug in"
    Case 18
        $excuse1="stack"
    Case 19
        $excuse1="encounter"
    Case 20
        $excuse1="climb"
    EndSwitch
    
    Return $excuse1
    
    ElseIf $type = "adj" Then
    
    $excuse2 = Random (1, 20, 1)
    
    Switch $excuse2
    Case 1
        $excuse2="rusty"
    Case 2
        $excuse2="crusty"
    Case 3
        $excuse2="crazy"
    Case 4
        $excuse2="angry"
    Case 5
        $excuse2="entertaining"
    Case 6
        $excuse2="hot"
    Case 7
        $excuse2="mad"
    Case 8
        $excuse2="mathematic"
    Case 9
        $excuse2="criminal"
    Case 10
        $excuse2="deadly"
    Case 11
        $excuse2="broken"
    Case 12
        $excuse2="lost"
    Case 13
        $excuse2="metalic"
    Case 14
        $excuse2="sharp"
    Case 15
        $excuse2="blue"
    Case 16
        $excuse2="frozen"
    Case 17
        $excuse2="telepathic"
    Case 18
        $excuse2="cultural"
    Case 19
        $excuse2="educational"
    Case 20
        $excuse2="scientific"
    EndSwitch
    return $excuse2
    ElseIf $type = "n" Then
    $excuse3 = Random (1, 20, 1)
    Switch $excuse3
    Case 1
        $excuse3="chili"
    Case 2
        $excuse3="grandma"
    Case 3
        $excuse3="arm"
    Case 4
        $excuse3="computer"
    Case 5
        $excuse3="keyboard"
    Case 6
        $excuse3="grandpa"
    Case 7
        $excuse3="cracker"
    Case 8
        $excuse3="soup"
    Case 9
        $excuse3="TV"
    Case 10
        $excuse3="cat"
    Case 11
        $excuse3="lamp"
    Case 11
        $excuse3="plant"
    Case 12
        $excuse3="light"
    Case 13
        $excuse3="table"
    Case 14
        $excuse3="dad"
    Case 15
        $excuse3="mom"
    Case 16
        $excuse3="brother"
    Case 17
        $excuse3="sister"
    Case 18
        $excuse3="shoe"
    Case 19
        $excuse3="door"
    Case 20
        $excuse3="telephone"
    EndSwitch
    Return $excuse3
    Else
    Return "{ERROR: Invalid argument passed to function}"
    EndIf
EndFunc

Func new()
    GUICtrlDelete ($excuse)
    $excuse = GUICtrlCreateLabel ( "I'd love to (insert unpleasant task here), but I have to " &  randomize("v") & " my " & randomize("adj") & " " & randomize("n") & "!", 10, 30 )
EndFunc
#endregion

hth

HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Link to comment
Share on other sites

I agree with w0uter.

CODE

#region GUI

Global Const $GUI_EVENT_CLOSE = -3

GUICreate("Random Excuse Generator")

GUISetState(@SW_SHOW)

$excuse = GUICtrlCreateLabel("I'd love to (insert unpleasant task here), but I have to ", 10, 30, 375, 30)

$button = GUICtrlCreateButton("Create New Random Excuse", 10, 60)

new()

GUISetState()

Do

$msg = GUIGetMsg()

If $msg = $button Then new()

Until $msg = $GUI_EVENT_CLOSE

Func randomize($type)

If $type = "v" Then

Local $a_excuse1[21] = [20, "eat", "drink", "attack", "notify", _

"materialize", "infuriate", "immobilize", "rip", "dry", _

"call", "run over", "curse", "break", "smash", "kiss", _

"attract", "plug in", "stack", "encounter", "climb"]

Return $a_excuse1[Random(1, 20, 1) ]

ElseIf $type = "adj" Then

Local $a_excuse2[21] = [20, "rusty", "crusty", "crazy", "angry", "entertaining", _

"hot", "mad", "mathematic", "criminal", "deadly", _

"broken", "lost", "metalic", "sharp", "blue", _

"frozen", "telepathic", "cultural", "educational", "scientific"]

Return $a_excuse2[Random(1, 20, 1) ]

ElseIf $type = "n" Then

Local $a_excuse3[21] = [20, "chili", "grandma", "arm", "computer", "keyboard", _

"grandpa", "cracker", "soup", "TV", "cat", _

"lamp", "plant", "light", "table", "dad", _

"mom", "brother", "sister", "shoe", "door"]

Return $a_excuse3[Random(1, 20, 1) ]

Else

Return "{ERROR: Invalid argument passed to function}"

EndIf

EndFunc ;==>randomize

Func new()

GUICtrlSetData($excuse, "I'd love to (insert unpleasant task here), but I have to " & randomize("v") & _

" my " & randomize("adj") & " " & randomize("n") & "!")

EndFunc ;==>new

#endregion

Edited by gafrost

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 added this to his script he posted in the scripts and scraps

$reason = GUICtrlCreateCombo("Reasons", 315, 62, 100, 20)
Guictrlsetdata( -1, "go|come|be there|jump on that|show up|help you|buy lunch|hang out|party with you|pay you|write your script|make it happen|chill|")

8)

NEWHeader1.png

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