narciso Posted May 7, 2007 Share Posted May 7, 2007 Hello again, I actually need to use MsgBox and get an answer from the user based on what they see on the screen. Unfortunately MsgBox covers some of the data crucial for the decision making process. Guessing that you cannot position MsgBox, have come up with the idea to simulate it with GUI. 1. The first problem I happened on is the size of my GUI that is different than what I want (according to AutoIt Info it is actually wider and higher?!). Of course I can fix it by putting smaller values for the GUICreate finction but it sucks... 2. Second, I would like the GUI to look identical to MsgBox, i.e. no minimize or maximize window option and a disabled cross mark for closing up the window (just like in the native MsgBox). 3. The size of buttons - any standards of heights used by MsgBox? 4. Button positioning - any possibility to automatically center both "Yes" and "No" buttons? 5. Maybe there is still a possibility of positioning a native MsgBox somehow? I have temporarily solved the problem by running another script that waits for the MsgBox and then moves it to optimal position on the screen but you can see it being moved and it looks bad Below I am enclosing a piece of the code illustrating my problem. If someone would care to help... Thanks in advance. ; #################### cut $msg = MsgBox(36, "Rozliczenia fiskalne", "Czy rozliczenie fiskalne jest OK?", 180) ; my original MsgBox that I want to mimick by GUI GUICreate("Rozliczenia fiskalne", 227, 126, -1, 385) ; GUICtrlCreateIcon ("explorer.exe", -8, 10, 10) ; question mark icon Opt("GUICoordMode", 2) GUICtrlCreateLabel ("Czy rozliczenie fiskalne jest OK?", 50, 10) Opt("GUICoordMode", 1) $yesButton = GUICtrlCreateButton ("Tak", 29, 60, 75, 22) GUICtrlSetState($yesButton, $GUI_FOCUS) Opt("GUICoordMode", 2) $noButton = GUICtrlCreateButton ("Nie", 20, -1) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $yesButton GUISetState (@SW_HIDE) Run('notepad.exe') ; Will Run/Open Notepad ExitLoop Case $msg = $noButton GUISetState (@SW_HIDE) MsgBox(0, 'Testing', 'Button 2 was pressed') ExitLoop EndSelect Wend ; #################### cut Warmly,Narciso Link to comment Share on other sites More sharing options...
MHz Posted May 7, 2007 Share Posted May 7, 2007 5. Maybe there is still a possibility of positioning a native MsgBox somehow? I have temporarily solved the problem by running another script that waits for the MsgBox and then moves it to optimal position on the screen but you can see it being moved and it looks bad SmOke_N and GAFrost did a post in Examples forum for using the Msgbox with another script that works well. Perhaps look at it and judge for yourself if it may serve your need.http://www.autoitscript.com/forum/index.ph...=32275&st=0 Link to comment Share on other sites More sharing options...
narciso Posted May 7, 2007 Author Share Posted May 7, 2007 SmOke_N and GAFrost did a post in Examples forum for using the Msgbox with another script that works well. Perhaps look at it and judge for yourself if it may serve your need.http://www.autoitscript.com/forum/index.ph...=32275&st=0Hm... actually I cannot understand a line of it. Very weird for me. The mouse cursor looks like being kept heavily busy by the script?! Still no answer to my positioning problems and all.Thank you anyway for giving it a try Still waiting for some more straight forward solution Warmly,Narciso Link to comment Share on other sites More sharing options...
James Posted May 7, 2007 Share Posted May 7, 2007 Well that basically is it. Use Koda for GUI making. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
eltorro Posted May 9, 2007 Share Posted May 9, 2007 Here is a simple UDF to move a MsgBox.It is not complicated at all. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now