Jump to content
Sign in to follow this  
Sobiech

I just dont understand why...

Recommended Posts

Sobiech

Hi again >_<

i rlly dont understand why i cant use buttons :( just if i click on button i dont see any move, any action :|

Here is my code

this DOESNT work

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form2 = GUICreate("Form2", 496, 382, 191, 120)

$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Admin\Moje dokumenty\Moje obrazy\Satan\BotScreen.jpg", 0, 0, 495, 381, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$Button1 = GUICtrlCreateButton("Here is your mp3", 320, 184, 145, 25, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Start", 32, 312, 147, 41, $WS_GROUP)

$Button3 = GUICtrlCreateButton("Exit", 312, 312, 147, 41, $WS_GROUP)

$Combo1 = GUICtrlCreateCombo("Set numnber of bws", 320, 216, 145, 25)

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

GUICtrlSetOnEvent($button1, "ExitButton") ; You must have this

GUISetOnEvent($GUI_EVENT_CLOSE, "ExitButton")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Func ExitButton()

MsgBox (0, "Exit", "You clicked EXIT! Exiting...")

Exit

EndFunc

This WORK

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Admin\Pulpit\GUI\Forms\First GUI.kxf

$Form1 = GUICreate("Form1", 524, 347, 198, 129)

$Button1 = GUICtrlCreateButton("Exit", 320, 296, 161, 33, $WS_GROUP)

$Button2 = GUICtrlCreateButton("Start", 40, 296, 161, 33, $WS_GROUP)

$Edit1 = GUICtrlCreateEdit("", 48, 96, 185, 89)

GUISetState(@SW_SHOW)

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

GUISetOnEvent($GUI_EVENT_CLOSE, "ExitButton")

GUICtrlSetOnEvent($button1, "ExitButton") ; You must have this

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Func ExitButton()

MsgBox (0, "Exit", "You clicked EXIT! Exiting...")

Exit

EndFunc

I have this problem in many projects :(

Few days ago i dont have this problem.

Ofcourse i reinstall AutoIT and again download Koda GUI (non beta) so only you can help me :|

Edited by Sobiech

This world is crazy

Share this post


Link to post
Share on other sites
Melba23

Sobiech,

How about if you changed this:

GUICtrlSetOnEvent($button1, "ExitButton")

to this:

GUICtrlSetOnEvent($button3, "ExitButton")

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Sobiech

Sobiech,

How about if you changed this:

GUICtrlSetOnEvent($button1, "ExitButton")

to this:

GUICtrlSetOnEvent($button3, "ExitButton")

M23

Doesnt work >_<

my all buttons doesnt work :( but i changed this :D

If any button dont have any code then when we click on him we can see "push animation". I dont have animations of buttons :(

Edited by Sobiech

This world is crazy

Share this post


Link to post
Share on other sites
Melba23

Sobiech,

This is from your code:

$Button1 = GUICtrlCreateButton("Here is your mp3", 320, 184, 145, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Start", 32, 312, 147, 41, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Exit", 312, 312, 147, 41, $WS_GROUP)
$Combo1 = GUICtrlCreateCombo("Set numnber of bws", 320, 216, 145, 25)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode 
GUICtrlSetOnEvent($button1, "ExitButton") ; You must have this

If you are in OnEvent mode, you need to define an action for each event/control. All you have at the moment is an action for button1 which is your "Here is your mp3" button. You have no events defined for the other buttons, so how do you expect them to react when pressed? Look at this:

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

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form2", 496, 382, 191, 120)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitButton")
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Admin\Moje dokumenty\Moje obrazy\Satan\BotScreen.jpg", 0, 0, 495, 381, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Button1 = GUICtrlCreateButton("Here is your mp3", 320, 184, 145, 25, $WS_GROUP)
GUICtrlSetOnEvent($Button1, "mp3")
$Button2 = GUICtrlCreateButton("Start", 32, 312, 147, 41, $WS_GROUP)
GUICtrlSetOnEvent($Button2, "Start")
$Button3 = GUICtrlCreateButton("Exit", 312, 312, 147, 41, $WS_GROUP)
GUICtrlSetOnEvent($Button3, "ExitButton") ; You must have this

$Combo1 = GUICtrlCreateCombo("Set numnber of bws", 320, 216, 145, 25)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd

Func ExitButton()
MsgBox (0, "Exit", "You clicked EXIT! Exiting...")
Exit
EndFunc

Func Start()
    MsgBox(0, "Start", "You pressed Start")
EndFunc

Func mp3()
    MsgBox(0, "mp3", "You pressed mp3")
EndFunc

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Yashied

Share this post


Link to post
Share on other sites
Sobiech

I think that you are confused in your code, or showed us it does not fully.

It is Fully >_<

i had working projects with GUI, but now any projects doesnt work :(

This is impossible to block buttons? maybe program settings have errors :|

To melba23:

If any button dont have any code then when we click on him we can see "push animation". I dont have animations of buttons :(

And your code dont activate my buttons :D

Edited by Sobiech

This world is crazy

Share this post


Link to post
Share on other sites
Yashied

Share this post


Link to post
Share on other sites
Sobiech

In such a case - this is poltergeist.

>_<

EDIT:

Try to work with Opt("GUIOnEventMode", 0).

Doesnt work :(

With 0 i closed program with ctrl+alt+del :D because i cant with click on [X] :(


This world is crazy

Share this post


Link to post
Share on other sites
Yashied

Share this post


Link to post
Share on other sites
Sobiech

Insert

GUICtrlSetState($Pic1, $GUI_DISABLE)

after

$Pic1 = GUICtrlCreatePic(...)

THX THX THX :(

Now its work!

Master >_<


This world is crazy

Share this post


Link to post
Share on other sites
Hawkwing

In the first code you posted you had guigetmsg inside the while loop, but you had opt("guisetonevent", 1). Thought those didn't work together >_


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites
Melba23

Hawkwing,

If you set Opt("GUISetOnEvent", 1) then (from the Help file) "the return from GUIGetMsg is always 0 and the @error is set to 1". So the function will not give you an error, but will not give you anything useful either! >_<

You can use the 2 modes in the same script without problem as long you are very careful in setting the Opt("GUISetOnEvent", ?) code as you move from one state to another. Here is a script I wrote a long time ago to illustrate how you might do it (not a very interesting script in itself, but it was to make the point about the mode changes):

#include <GUIConstantsEx.au3>

Global $running = False;

Opt("GUIOnEventMode", 1) ; Set OnEvent mode

$GUI = GUICreate("Test", 150, 80)
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")

$label = GUICtrlCreateLabel("OnEvent", 10, 15, 100, 20)
$counter = GUICtrlCreateLabel("", 120, 15, 25, 20)
$start = GUICtrlCreateButton("Start", 20, 44, 60)
    GUICtrlSetOnEvent($start, "start")
$stop = GUICtrlCreateButton("Stop", 80, 44, 60)
    GUICtrlSetState($stop, $GUI_DISABLE)

GUISetState(@SW_SHOW)

While (1)
    Sleep(100)
WEnd

;-------------------------

Func close()
    Exit
EndFunc   ;==>close

Func start()
    $running = True
    $ms = 500
    GUICtrlSetState($start, $GUI_DISABLE)
    GUICtrlSetState($stop, $GUI_ENABLE)

    Opt("GUIOnEventMode", 0) ; Switch to MessageLoop mode
    GUICtrlSetData($label, "MessageLoop")

    $begin = TimerInit()
    $count = 1

    While ($running)

        GUICtrlSetData($counter, $count)

        While TimerDiff($begin) < $ms

            If GUIGetMsg() = $stop Then
                stop()
                GUICtrlSetState($start, $GUI_ENABLE)
                GUICtrlSetData($counter, "")
                ExitLoop 2
            EndIf

        WEnd

        $begin = TimerInit()
        $count += 1

    WEnd
    Opt("GUIOnEventMode", 1) ; Switch to OnEvent mode
    GUICtrlSetData($label, "OnEvent")

    GUICtrlSetState($start, $GUI_ENABLE)
EndFunc   ;==>start

Func stop()
    GUICtrlSetState($stop, $GUI_DISABLE)
    $running = False
EndFunc   ;==>stop

I hope that make it all clear!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Leonick

THX THX THX :(

Now its work!

Master >_<

Why did it solve the problem?

something wrong with the pic?

Share this post


Link to post
Share on other sites
BrettF
Melba23

Leonick,

This problem comes up every day or so - because people do not use Search or read the Help file. From the Help file remarks for GUICtrlCreatePic:

"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE)".

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.