non editable text box?
BlitzPlus Forums/BlitzPlus Programming/non editable text box?
| ||
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) |
| ||
if the user shouldn't be able to modify the txt *ever*, use a label :) |
| ||
You can use DisableGadget(...) |
| ||
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? |
| ||
use a canvas.. |
| ||
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 |
| ||
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? |
| ||
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). |
| ||
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 |
| ||
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? |
| ||
Yo Lucid Not exactly sure where your coming from with this question? Mr Brine |
| ||
just resize the panel? |
| ||
lucid,about posting... Search before you post. I asked this question recently, as did many others. Just a hint ;) |
| ||
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..? |