non editable text box?

BlitzPlus Forums/BlitzPlus Programming/non editable text box?

gellyware(Posted 2003) [#1]
Hi,

I would like to know how to program the gui text box so that the user can NOT add text, or select text, etc. I am using the following command...
displayText =  CreateTextArea (0,0, ClientWidth(canvas),GadgetHeight(canvas),canvas,1)



CS_TBL(Posted 2003) [#2]
if the user shouldn't be able to modify the txt *ever*, use a label :)


soja(Posted 2003) [#3]
You can use DisableGadget(...)


gellyware(Posted 2003) [#4]
the label doesnt allow you to set a background color though? and DisableGadget makes the background look disable ;) Any other ways maybe? Or is there a way to apply color to either of the diablegadet or label commands?


CS_TBL(Posted 2003) [#5]
use a canvas..


Eikon(Posted 2003) [#6]
Credit goes to Nullmind:

; lib "user32.dll"
; SendMessage%(hWnd%,Msg%,wParam%,lParam%):"SendMessageA"
Const EM_SETREADONLY = $CF
Global win=CreateWindow("Readonly textbox",64,64,320,240)
Global Txt=CreateTextArea(0,0,1,1,win)
SendMessage QueryObject(Txt,1),EM_SETREADONLY,True,0



gellyware(Posted 2003) [#7]
hey Eikon, thanks...
I found that little snippet as well, however Im a newbie. I dont know how to include a dll file, nor how to use it properly. If I run the code you have above alone, I get an error. How can I use that code properly?


soja(Posted 2003) [#8]
You have to put these two lines:
lib "user32.dll"
SendMessage%(hWnd%,Msg%,wParam%,lParam%):"SendMessageA"

...into one of the .decls files in your userlibs folder. An easy way is just to create a "user32.decls" file, copy the two lines in, and save it. If you already happen to have one, make sure the "lib "user32.dll"" line is only entered once (in any of the decls files).


Mr Brine(Posted 2003) [#9]
Howdy

Their is another way that dont use dll's Check it out:

;-------------------------------------------------------

t = CreateWindow("", 100, 100, 200, 200)
p = CreatePanel(0, 0, 50, 50, t)
ta = CreateTextArea(0, 0, 50, 50, t)

Repeat
forever

;--------------------------------------------------------

the things to remeber are:

- to define the panel before u define the text area
- make sure the panel is the same size and position as the text area

Hope this helps

Mr Brine


gellyware(Posted 2003) [#10]
Wow, Mr Brine, This is something else. Thank you all kindly for your posts. And if I needed something where the texbox is longer but not wider than the panel , I guess it wouldnt work?


Mr Brine(Posted 2003) [#11]
Yo Lucid

Not exactly sure where your coming from with this question?

Mr Brine


soja(Posted 2003) [#12]
just resize the panel?


rdodson41(Posted 2003) [#13]
lucid,about posting...
Search before you post. I asked this question recently, as did many others. Just a hint ;)


CS_TBL(Posted 2003) [#14]
well, asking things that have been asked before can't be avoided imo.

ppl on a phoneline for example, aren't happy to browse through all the pages of each category to find some answers.

can't a mod categorise/organise all questions&answers in a code-related Q/A part of this site..?