Jump to content

Checkbox GUI error?


Imppilot
 Share

Recommended Posts

Ok so standard disclaimer....I normally only use autoit for scripts and I've never gone into this much "coding" so create something "pretty" sooo...newer to GUI part.

I have a function called _ATUGui and it runs great on its own. It lists 3 check boxes and does what I want when check, unchecked and upon exit. However. As soon as I call _ATUGui as a function from another script it breaks. By that I mean it only displays one check box and the rest is just blank.

Same thing happens if I paste the code from the function into the main script so something has to be fighting between the two but I can't figure out what. Posted below is the code.

FUNCTION

CODE
Func _ATUGui()

GUICreate("Pick hotlists", 150, 500) ; will create a dialog box that when displayed is centered

$psphot = GUICtrlCreateCheckbox ("PSP", 50, 10, 100, 100)

$cidhot1 = GUICtrlCreateCheckbox("CID", 50, 120, 100, 100)

$scoffhot = GUICtrlCreateCheckbox("Scoff", 50, 240, 100, 100)

$ok = GUICtrlCreateButton ("Finished", 45, 400)

GUISetState()

; Run the GUI until the dialog is closed

While 1

$msg1 = GUIGetMsg()

$box1 = GUICtrLRead($psphot)

$box2 = GUICtrlRead($cidhot1)

$box3 = GUICtrlRead($scoffhot)

Select

Case $msg1 = $GUI_EVENT_CLOSE

ExitLoop

Case $msg1 = $ok

Exitloop

Case $box1 = $GUI_CHECKED

$check1 = _PSP()

Case $box2 = $GUI_CHECKED

$check2 = _CID()

Case $box3 = $GUI_CHECKED

$check3 = _scoff()

EndSelect

Wend

GUIDelete()

Endfunc

What I want the function called from

CODE
#include <GUIConstants.au3>

#include <lpr.au3>

#include <atugui.au3>

;Create dialog box that when displayed is centered

$main = GUICreate("LCPD LRP", 325, 100)

;Background image $background = GUICtrlCreatePic ("badge2.bmp", 50, 50)

Opt("GUICoordMode",2)

$Button_1 = GUICtrlCreateButton ("Officer", 10, 30, 100)

$Button_2 = GUICtrlCreateButton ("PEA", 0, -1)

$Button_3 = GUICtrlCreateButton ("ATU/Special", 0, -1)

GUISetState () ; will display an dialog box with 3 button

; Run the GUI until the dialog is closed

While 1

Local $msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1 ;Run PA + CID for Officer

_PSP()

_CID()

ExitLoop

Case $msg = $Button_2 ; Run Scoff Only for PEA

_scoff()

ExitLoop

Case $msg = $Button_3 ; Runs ATU GUI with checkboxs

GUIDelete()

_ATUGui()

Exitloop

EndSelect

Wend

$data = _DataMerge()

Exit

Like all things this week I'm sure is a random symbol I'm missing or something small....i hope....

"Could be worse. Could be raining."

Link to comment
Share on other sites

hello,

maybe there is problem with the include:

shouldn't it look like:

#include "atugui.au3"

just a tip, I think this, becoz' I couldn't find this atugui.au3 at the general includes but i'll try now..

and i see there is other problem too both of the file contains part for:

"GUISetState()

; Run the GUI until the dialog is closed"

I think if you include one UDF only the main file has to handle the gui, but maybe I wrong

Edited by dworld

dworldI'm new in autoit, but I like it. My mind is open to the new things.

Link to comment
Share on other sites

No...its a UDF, I made is myself....just like the lpr include, which runs perfect.

You have to save the one as atugui.au3 and then include and invoke.

EDIT:

I thought they both had too because if atugui is invoked...it first deleted the first gui so in theory it has to create an entirely new one

Edited by Imppilot

"Could be worse. Could be raining."

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