Docfxit Posted January 19, 2007 Share Posted January 19, 2007 (edited) I'd like to find a way to create a MsgBox that a person could copy some text out of. I don't know if there is an easier way to create a copyable MsgBox. I don't know if I'm creating something that is way more complicated than it needs to be. I'm open to suggestions. The code I created below has two problems. 1. The box it creates doesn't have the correct width and height. I'd like it to be dynamic depending on the text of the message. 2. The first box doesn't close when the X in the top right corner is clicked. #include <GUIconstants.au3> $DebugMsg = "This doesn't create the correct size box" DisplayMsg($DebugMsg) ; Do some stuff $DebugMsg = "The first box doesn't close" DisplayMsg($DebugMsg) ; Do more stuff Func DisplayMsg($DebugMsg) $BoxWidth = StringLen($DebugMsg) GuiCreate("Information Message", $BoxWidth*2.5 +25, 160,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $inputText = GuiCtrlCreateEdit($DebugMsg, 10, 10, $BoxWidth*2.5 + 5, 140) GUICtrlSetStyle($inputText, $ES_READONLY) GUICtrlSetBkColor($inputText, 0xC0F0F0) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc Thank you, Docfxit Edited January 19, 2007 by docfxit Link to comment Share on other sites More sharing options...
Valuater Posted January 19, 2007 Share Posted January 19, 2007 (edited) maybe... #include <GUIconstants.au3> $DebugMsg = "This doesn't create the correct size box" DisplayMsg($DebugMsg) ; Do some stuff $DebugMsg = "The first box doesn't close" DisplayMsg($DebugMsg) ; Do more stuff $DebugMsg = "This doesn't create the correct size box or maybe it does if i really read all of this information... thanks Valuater" DisplayMsg($DebugMsg) Func DisplayMsg($DebugMsg) $BoxWidth = StringLen($DebugMsg) * 4.5 + 20 $Boxer = GuiCreate("Information Message", $BoxWidth +20, 160,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $inputText = GuiCtrlCreateEdit($DebugMsg, 10, 10, $BoxWidth, 140) GUICtrlSetStyle($inputText, $ES_READONLY) GUICtrlSetBkColor($inputText, 0xC0F0F0) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete($Boxer) EndFunc 8) Edited January 19, 2007 by Valuater Link to comment Share on other sites More sharing options...
Docfxit Posted January 19, 2007 Author Share Posted January 19, 2007 That's really great Valuater. That solved both problems. Thank you very much. Docfxit Link to comment Share on other sites More sharing options...
Valuater Posted January 19, 2007 Share Posted January 19, 2007 Welcome 8) 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