Jump to content



Photo

DOS-Like Edit Control


  • Please log in to reply
2 replies to this topic

#1 McGod

McGod

    Formerly Chip

  • Active Members
  • PipPipPipPipPipPip
  • 589 posts

Posted 15 November 2007 - 08:32 PM

How can I make a edit control so that I can let them input into the edit control, but not let them edit what was already outputted above, like DOS.







#2 dani

dani

    Polymath

  • Active Members
  • PipPipPipPip
  • 215 posts

Posted 15 November 2007 - 09:24 PM

How can I make a edit control so that I can let them input into the edit control, but not let them edit what was already outputted above, like DOS.

Ehm, just output stuff they write to like, a label or whatever they can not change?

So you have an edit control and a control that is writable and can scroll when needed. Whenever stuff is entered in the edit control and enter is pressed or a button is pressed you read the input control, put the text on the other control and empty the edit control...

#3 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,078 posts

Posted 15 November 2007 - 09:28 PM

only way i know is to keep them separate input/output

AutoIt         
#include <GUIConstants.au3> #include <Constants.au3> Global $cmdinfo GUICreate("dosprompt", 334, 424, -1, -1) $cmd = GUICtrlCreateInput("", 40, 10, 200, 20) $textorso1 = GUICtrlCreateLabel("CMD:", 10, 10, 25, 20) $Close = GUICtrlCreateButton("Close!", 10, 384, 80, 20) $Clear = GUICtrlCreateButton("Clear", 100, 384, 80, 20) $Closex = GUICtrlCreateButton("sendcommand!", 245, 10, 80, 20) GUICtrlSetState( -1, $GUI_DEFBUTTON) $Outputbox = GUICtrlCreateEdit("[incomminginput]", 10, 55, 314, 300, $ES_READONLY + $ES_MULTILINE + $WS_HSCROLL + $WS_VSCROLL + $ES_AUTOVSCROLL) GUICtrlSetBkColor( -1, "") GUICtrlSetColor( -1, 0xfffafa) GUISetState(@SW_SHOW) recall_command("dir c:\") $msg = 0 While $msg <> $GUI_EVENT_CLOSE     $msg = GUIGetMsg()     Select         Case $msg = $Close             ExitLoop         Case $msg = $Clear             GUICtrlSetData($Outputbox, "[incomminginput]")         Case $msg = $Closex             $inputz = GUICtrlRead($cmd)             recall_command($inputz);     EndSelect WEnd Func recall_command($info)     $cmdinfo = Run(@ComSpec & " /c " & $info,  @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD)     While 1         $line = StdoutRead($cmdinfo)         If @error Then Return         GUICtrlSetData($Outputbox, GUICtrlRead($Outputbox) & @CRLF & $line);     WEnd EndFunc   ;==>recall_command


8)

Posted Image

Clic The Pic!!!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users