Sign in to follow this  
Followers 0
Imppilot

Checkbox GUI error?

10 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

well i cannot test your code, because in atGui.au3 are few functions which are declarated in lpr.au3


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

Share this post


Link to post
Share on other sites

if you can see all three checkboxes when calling atugui from the main code thats the main thing. lpr wont help as those function call things from our server.


"Could be worse. Could be raining."

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

yes, i see now, i'll try o guess sg

edit:

well it's very strange, with LxP's FindClassesByText example script you can see the checkboxes on _ATUGui() createted gui..

Edited by dworld

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

Share this post


Link to post
Share on other sites

well I found the solution!

the problem was with

Opt("GUICoordMode",2)

I hope this will solve your problem..


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

Share this post


Link to post
Share on other sites

PERFECT!!!!!!!!!!!!!!!!!!!! Love to know why but not sure I care right now!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thanks!


"Could be worse. Could be raining."

Share this post


Link to post
Share on other sites

:) I'm happy that i could help!

one more thing, could you change the title to:

[solved]Checkbox GUI error?

just to follow the rules.. >_<


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

Share this post


Link to post
Share on other sites

As soon as I figure out how to I will


"Could be worse. Could be raining."

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