Sign in to follow this  
Followers 0
slightly_abnormal

How Do I Create A Edit Box Which Is Disabled Except..

6 posts in this topic

#1 ·  Posted (edited)

how do i create an editbox which is disabled (cant edit the text) but the background color would be white, andfor some reason it has 30 lines but it only goes to 20, i'd like to it go to all lines with a scroll bar, and the text can be copied too.. :">

#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, $ES_READONLY, $WS_EX_CLIENTEDGE)
GUICtrlSetData($Edit1, "1"&@CRLF&"2"&@CRLF&"3"&@CRLF&"4"&@CRLF&"5"&@CRLF&"6"&@CRLF&"7"&@CRLF&"8"& _
@CRLF&"9"&@CRLF&"10"&@CRLF&"11"&@CRLF&"12"&@CRLF&"13"&@CRLF&"14"&@CRLF&"15"&@CRLF&"16"&@CRLF&"17"& _
@CRLF&"18"&@CRLF&"19"&@CRLF&"20"&@CRLF&"21"&@CRLF&"22"&@CRLF&"23"&@CRLF&"24"&@CRLF&"25"&@CRLF&"26"& _
@CRLF&"27"&@CRLF&"28"&@CRLF&"29"&@CRLF&"30")
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit

nvm I figured it out. :) if anyone if interested i'll post how i got what i wanted..

Edited by slightly_abnormal

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

how do i create an editbox which is disabled (cant edit the text) but the background color would be white, andfor some reason it has 30 lines but it only goes to 20, i'd like to it go to all lines with a scroll bar, and the text can be copied too.. :">

#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, $ES_READONLY, $WS_EX_CLIENTEDGE)
GUICtrlSetData($Edit1, "1"&@CRLF&"2"&@CRLF&"3"&@CRLF&"4"&@CRLF&"5"&@CRLF&"6"&@CRLF&"7"&@CRLF&"8"& _
@CRLF&"9"&@CRLF&"10"&@CRLF&"11"&@CRLF&"12"&@CRLF&"13"&@CRLF&"14"&@CRLF&"15"&@CRLF&"16"&@CRLF&"17"& _
@CRLF&"18"&@CRLF&"19"&@CRLF&"20"&@CRLF&"21"&@CRLF&"22"&@CRLF&"23"&@CRLF&"24"&@CRLF&"25"&@CRLF&"26"& _
@CRLF&"27"&@CRLF&"28"&@CRLF&"29"&@CRLF&"30")
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit

nvm I figured it out. :) if anyone if interested i'll post how i got what i wanted..

Don't think you can keep the background white with ReadOnly
#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, BitOR($ES_READONLY, $WS_VSCROLL), $WS_EX_CLIENTEDGE)
GUICtrlSetData($Edit1, "1"&@CRLF&"2"&@CRLF&"3"&@CRLF&"4"&@CRLF&"5"&@CRLF&"6"&@CRLF&"7"&@CRLF&"8"& _
@CRLF&"9"&@CRLF&"10"&@CRLF&"11"&@CRLF&"12"&@CRLF&"13"&@CRLF&"14"&@CRLF&"15"&@CRLF&"16"&@CRLF&"17"& _
@CRLF&"18"&@CRLF&"19"&@CRLF&"20"&@CRLF&"21"&@CRLF&"22"&@CRLF&"23"&@CRLF&"24"&@CRLF&"25"&@CRLF&"26"& _
@CRLF&"27"&@CRLF&"28"&@CRLF&"29"&@CRLF&"30")
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit

Edit:

Also if your going to use numbers like that, you might try a loop:

#include <GUIConstants.au3>
Local $HoldVar = ''
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, BitOR($ES_READONLY, $WS_VSCROLL), $WS_EX_CLIENTEDGE)
For $xCount = 1 To 30
    $HoldVar &= $xCount & @CRLF
Next
GUICtrlSetData($Edit1, StringTrimRight($HoldVar, 2))
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Don't think you can keep the background white with ReadOnly

#include <GUIConstants.au3>
Smokey, How could you forget about

GUICtrlSetBKColor($Edit1,0XFFFFFF)

:)

HardCopy


Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Don't think you can keep the background white with ReadOnly

#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, BitOR($ES_READONLY, $WS_VSCROLL), $WS_EX_CLIENTEDGE)
GUICtrlSetData($Edit1, "1"&@CRLF&"2"&@CRLF&"3"&@CRLF&"4"&@CRLF&"5"&@CRLF&"6"&@CRLF&"7"&@CRLF&"8"& _
@CRLF&"9"&@CRLF&"10"&@CRLF&"11"&@CRLF&"12"&@CRLF&"13"&@CRLF&"14"&@CRLF&"15"&@CRLF&"16"&@CRLF&"17"& _
@CRLF&"18"&@CRLF&"19"&@CRLF&"20"&@CRLF&"21"&@CRLF&"22"&@CRLF&"23"&@CRLF&"24"&@CRLF&"25"&@CRLF&"26"& _
@CRLF&"27"&@CRLF&"28"&@CRLF&"29"&@CRLF&"30")
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit

Edit:

Also if your going to use numbers like that, you might try a loop:

#include <GUIConstants.au3>
Local $HoldVar = ''
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, BitOR($ES_READONLY, $WS_VSCROLL), $WS_EX_CLIENTEDGE)
For $xCount = 1 To 30
    $HoldVar &= $xCount & @CRLF
Next
GUICtrlSetData($Edit1, StringTrimRight($HoldVar, 2))
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit
yes you can

#include <GUIConstants.au3>
Global Const $EM_SETREADONLY = 0xCF

Local $HoldVar = ''
$Form1 = GUICreate("AForm1", 281, 354, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 56, 16, 177, 273, -1, $WS_EX_CLIENTEDGE)
For $xCount = 1 To 30
    $HoldVar &= $xCount & @CRLF
Next
GUICtrlSetData($Edit1, StringTrimRight($HoldVar, 2))
$Button1 = GUICtrlCreateButton("AButton1", 80, 304, 113, 41)
GUICtrlSendMsg($Edit1, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($Edit1,0xFFFFFF)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE or $msg = $Button1
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Well slap my a** and color me purple... I had never even tried it :)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Well slap my a** and color me purple... I had never even tried it :)

I'll skip the 1st part, but just so happens I have purple house paint.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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