Sign in to follow this  
Followers 0
satanttin

Little question (very simple i thinkO.o)

9 posts in this topic

Hello,

I have a question about something if that's possible or not.

the thing is i have a gui with a menu and i want that if i press a menuitem some stuff will show on the gui. but also want if i press another menuitem that other stuff will apear and the first data will be hide.

is this possible? and ifso how can i do this with onevent code?

Thanks in advance:)

Share this post


Link to post
Share on other sites



satanttin,

i have a gui with a menu

Post what you have...

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

what i tried so far is:

func test()

$Button1 = GUICtrlCreateButton("Button1", 288, 248, 193, 57)

endfunc

but when i press the menuitem it won't put the button in the gui so that's not possible i guess:') or i am doingsomething wrong

Share this post


Link to post
Share on other sites

this is what i got so far just part i tried doesn't work:(

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
Global $Form1

Opt("GUIOnEventMode", 1)

main()
Func main()
$Form1 = GUICreate("Home", 1063, 749, 341, 199)
$MenuItem4 = GUICtrlCreateMenu("Menu")
$MenuItem8 = GUICtrlCreateMenuItem("Save", $MenuItem4)
GUICtrlSetOnEvent($MenuItem8, "Save")
$MenuItem7 = GUICtrlCreateMenuItem("Load", $MenuItem4)
GUICtrlSetOnEvent($MenuItem7, "Load")
$MenuItem6 = GUICtrlCreateMenuItem("empy", $MenuItem4)
GUICtrlSetOnEvent($MenuItem6, "empty")
$MenuItem5 = GUICtrlCreateMenuItem("Close", $MenuItem4)
GUICtrlSetOnEvent($MenuItem5, "Close")
$MenuItem3 = GUICtrlCreateMenu("test")
GUICtrlSetOnEvent($MenuItem3, "test")
$MenuItem2 = GUICtrlCreateMenu("empty")
GUICtrlSetOnEvent($MenuItem2, "empty")
$MenuItem1 = GUICtrlCreateMenu("empty")
GUICtrlSetOnEvent($MenuItem1, "empty")
$MenuItem10 = GUICtrlCreateMenuItem("Help", $MenuItem1)
GUICtrlSetOnEvent($MenuItem10, "Help")
$MenuItem9 = GUICtrlCreateMenuItem("Credits", $MenuItem1)
GUICtrlSetOnEvent($MenuItem9, "Credits")
GUISetState()
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
EndFunc


Func test()
   $Button1 = GUICtrlCreateButton("Button1", 288, 248, 193, 57)
EndFunc

While 1
sleep(10)
WEnd

Func Close()
Exit
EndFunc

Share this post


Link to post
Share on other sites

Hi,

Try this :

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Global $hForm1 = 0, $iButton1 = 0, $iButton2 = 0

Main()
Func Main()
    Local $iMenuItem4 = 0, $iMenuItem7 = 0, $iMenuItem8 = 0

    $hForm1 = GUICreate("MyGUI")
    GUISetOnEvent($GUI_EVENT_CLOSE, "Close")

    $MenuItem4 = GUICtrlCreateMenu("Menu")

    $MenuItem8 = GUICtrlCreateMenuItem("Save", $MenuItem4)
    GUICtrlSetOnEvent($MenuItem8, "_Save")

    $MenuItem7 = GUICtrlCreateMenuItem("Load", $MenuItem4)
    GUICtrlSetOnEvent($MenuItem7, "_Load")

    GUISetState(@SW_SHOW, $hForm1)
EndFunc   ;==>main

Func _Save()
    If $iButton1 > 0 Then
        If $iButton2 > 0 Then GUICtrlSetState($iButton2, $GUI_HIDE)
        GUICtrlSetState($iButton1, $GUI_SHOW)
    EndIf

    $iButton1 = GUICtrlCreateButton("Button1", 20, 20, 200, 57)
EndFunc   ;==>test

Func _Load()
    If $iButton2 > 0 Then
        If $iButton1 > 0 Then GUICtrlSetState($iButton1, $GUI_HIDE)
        GUICtrlSetState($iButton2, $GUI_SHOW)
    EndIf

    $iButton1 = GUICtrlCreateButton("Button2", 20, 200, 200, 57)
EndFunc

While 1
    Sleep(1000)
WEnd

Func Close()
    GUIDelete($hForm1)
    Exit
EndFunc   ;==>Close

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi,

Try this :

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

Global $hForm1 = 0, $iButton1 = 0, $iButton2 = 0

Main()
Func Main()
    Local $iMenuItem4 = 0, $iMenuItem7 = 0, $iMenuItem8 = 0

    $hForm1 = GUICreate("MyGUI")
    GUISetOnEvent($GUI_EVENT_CLOSE, "Close")

    $MenuItem4 = GUICtrlCreateMenu("Menu")

    $MenuItem8 = GUICtrlCreateMenuItem("Save", $MenuItem4)
    GUICtrlSetOnEvent($MenuItem8, "_Save")

    $MenuItem7 = GUICtrlCreateMenuItem("Load", $MenuItem4)
    GUICtrlSetOnEvent($MenuItem7, "_Load")

    GUISetState(@SW_SHOW, $hForm1)
EndFunc ;==>main

Func _Save()
    If $iButton1 > 0 Then
        If $iButton2 > 0 Then GUICtrlSetState($iButton2, $GUI_HIDE)
        GUICtrlSetState($iButton1, $GUI_SHOW)
    EndIf

    $iButton1 = GUICtrlCreateButton("Button1", 20, 20, 200, 57)
EndFunc ;==>test

Func _Load()
    If $iButton2 > 0 Then
        If $iButton1 > 0 Then GUICtrlSetState($iButton1, $GUI_HIDE)
        GUICtrlSetState($iButton2, $GUI_SHOW)
    EndIf

    $iButton1 = GUICtrlCreateButton("Button2", 20, 200, 200, 57)
EndFunc

While 1
    Sleep(1000)
WEnd

Func Close()
    GUIDelete($hForm1)
    Exit
EndFunc ;==>Close

Br, FireFox.

tried your code and it does shown the buttons just when i press another the other stuff will remain there:( i don't want that to happen:P

and i don't really understand your coding:P but that's just a matter of minutes till i do so just one problem xD

Share this post


Link to post
Share on other sites

Meh i just use one gui as my menu and then use sub gui's to show my content:P like a floating menu thing ^^ would be cooler anywaysO.o i think

Share this post


Link to post
Share on other sites

and the question is ?


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

and the question is ?

huh what question?

sorry i feel dumb right now:')

Share this post


Link to post
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
Sign in to follow this  
Followers 0