Sign in to follow this  
Followers 0
redpicker

I need help with GUI

3 posts in this topic

OK, not only am I a newbie, but I'm not a programmer. My programming skils date back to the 1970's (the last programming class I took was Carter was president) and used punch cards. I've picked-up things here and there, but there are a lot of concepts I just don't understand.

Anyway, I've written a program that will interact with a canned MRP system to enter, retrieve, and maniplate part numbers, manufacturing run times, etc... I now would like to make a GUI for it so that my other Engineers can easily use it. I don't understand how to make it run, however.

From the examples, I have written the following code

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
 
Example()
 
Func Example()
Local $widthCell, $oVANO, $btn, $msg
  Opt("GUICoordMode", 1)
GUICreate("MY GUI", 320, 320, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 145, -1)  ; will create a dialog box that when displayed is centered
GUISetHelp("notepad")  ; will run notepad if F1 is typed
$widthCell = 170
GUICtrlCreateLabel("Enter Variant Number", 10, 35, $widthCell) ; first cell 70 width
$oVANO = GUICtrlCreateInput("Number goes here", 10, 55, 170, 20)
$btn = GUICtrlCreateButton("Close", 10,280)
GUISetState()
; Run the GUI until the dialog is closed
Do
  $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

What I can't figure out is how

1) when I enter a part number in the input box, have it run the program and,

2) when I click the "Close" button, have it stop the program

I've read about GUI MessageLoop Mode and GUI OnEvent Mode, and I can't even determine which would be best. I have no preference, but I will want to add a drop-down box, additional input boxes, and some checkboxes to the GUI window, all of which will depend on the nature of the part number. I've been stuck on this for two days, now, and I am just about ready to give-up and just use input boxes and message boxes to take care of this, but it sure would be nice to make it look a bit more like a "real program".

Thanks,

rp

Share this post


Link to post
Share on other sites



here is a small example based on your GUI above...

#include <GUIConstantsEx.au3>
GUICreate("MY GUI")
GUISetHelp("notepad") ; will run notepad if F1 is typed
$widthCell = 170
;GUICtrlCreateLabel("Enter Variant Number", 10, 35, $widthCell) ; first cell 70 width
$oVANO = GUICtrlCreateButton("Run Notepad", 10, 55, 170, 20)
$btn = GUICtrlCreateButton("Close", 10, 280)
GUISetState()
; Run the GUI until the dialog is closed
While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = $btn
   Exit
  Case $msg = -3
   Exit ; same as red "X" top corner
  Case $msg = $oVANO
   Run("Notepad.exe")
 EndSelect
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

That's great!

Not really what I wanted, but probably what I needed...

By changing what you posted to do what I want, I think I may understand this a little more.

Thank you for getting me to figure it out!

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