Jump to content

Button and apear other button


Recommended Posts

Maybe AnyGUI will help you.

jfcby

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        [color="#FF0000"]case $button1[/color]
            [color="#9ACD32"]$group2 = GUICtrlCreateButton("Button12", 192, 40, 145, 33, 0)[/color]

        
 EndSwitch
Wend

who can i put a ShellExecute in this code?

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        [color="#FF0000"]case $button1[/color]
            [color="#9ACD32"]$group2 = GUICtrlCreateButton("Button12", 192, 40, 145, 33, 0)[/color]
shellexecute("www.google.com")

        
 EndSwitch
Wend

is this code?

Edited by chorao157
Link to comment
Share on other sites

This maybe what you are looking for...

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $button1           
            shellexecute("www.google.com")
            $group2 = GUICtrlCreateButton("Button12", 192, 40, 145, 33, 0)
            GUICtrlSetColor(-1, 0x9ACD32)   ;        
    EndSwitch
Wend

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

@jfcby

no is this, i need if click "button12" execute the shellexecute("www.google.com")

@edit

EXAMPLE:

I clik on a button, another button appears in the second group I clik on that button in the group two and it runs the shell and opens the web page you see?

Edited by chorao157
Link to comment
Share on other sites

This maybe what you are looking for...

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $button1           
            shellexecute("www.google.com")
            $group2 = GUICtrlCreateButton("Button12", 192, 40, 145, 33, 0)
            GUICtrlSetColor(-1, 0x9ACD32)   ;        
    EndSwitch
Wend

Whoa up!!!!! Never, ever, ever create a control in a message loop. Show/hide/disble/enable = fine, create = not good. In this case every time someone clicks $button1, you are creating another button over top of the one previously created. You could get away with it if you have a GUICtrlDelete() but even that is a bad practice.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create all of your controls at the same time in the GUI and then use GUISetState() to show or hide them. Don't create them in the message loop. You seem to think you are re-using the same control because it's using the same variable. That's simply not the case, you are only re-using the variable while creating a new conrol over top of the one you create the first time.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 464, 398, 198, 123)
$Group1 = GUICtrlCreateGroup(" ------------ ", 8, 16, 169, 377)
$Button1 = GUICtrlCreateButton("1", 16, 40, 153, 25, 0)
$Button2 = GUICtrlCreateButton("2",16, 72, 153, 25, 0)
$Button3 = GUICtrlCreateButton("3", 16, 104, 153, 25, 0)
$Button4 = GUICtrlCreateButton("4", 16, 136, 153, 25, 0)
 $Button5 = GUICtrlCreateButton("5", 16, 168, 153, 25, 0)
$Button6 = GUICtrlCreateButton("6", 16, 200, 153, 25, 0)
$Button7 = GUICtrlCreateButton("7", 16, 232, 153, 25, 0)
$Button8 = GUICtrlCreateButton("8", 16, 264, 153, 25, 0)
$Button9 = GUICtrlCreateButton("9", 16, 296, 153, 25, 0)
$Button10 = GUICtrlCreateButton("0", 16, 328, 153, 25, 0)
$Button11 = GUICtrlCreateButton("10", 16, 360, 153, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup(" 11 ", 184, 16, 273, 377)
$button12 = GUICtrlCreateButton("12", 192, 40, 145, 33, 0)
Guictrlsetstate(-1, $GUI_HIDE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $button1 
            $group2 = Guictrlsetstate(-1, $GUI_SHOW)
                          $button12 ; ===> correct?
            
        
        
                  EndSwitch
              Wend

Edited by chorao157
Link to comment
Share on other sites

  • Moderators

chorao157,

Close, but no cigar! ;)

Case $Button1
    GUICtrlSetState($button12, $GUI_SHOW)

M23

P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. :blink:

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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