How to change "input field" code in dialogue.

hello all,

I am new to c++, so I got question here:

currently I have below code through which the user gives input to proceed.

CONTROL "", 1005, EDIT, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP, 77, 44, 65, 12 , 0x00020000

I want that a default field to be placed, that user may not able to enter value and it must have a default value in that box.

How should I do?
please specify with quotes as I may understand!
Based on some of what you wrote this is for the Windows Platform correct? Is this actually C++? If so I think you're trying to enter arguments for one of the window creation functions but I'm not sure which. Could you tell us which function you are trying to use this with?
Last edited on
That line looks like a dialog resources line -the file could have a .rc or .res extension, if you're using visual studio just open it in VS resource editor, or use a resource editor like ResEdit:
http://www.resedit.net/

a default field to be placed, that user may not able to enter value and it must have a default value in that box.

(using a resource editor) Put a static text control inside a (caption-less) group box
Another way to do this with a slightly different look would be to use a CStatic control instead. If you assign it an ID that is not IDC_STATIC then you can also assign any text to it at run time and it looks more like a label so users won't think there is some magic way to enable it that they just don't know. The only time this really breaks down is if you need scrolling text.

I'm not a huge fan of read only edit controls because I think it is frustrating when you can't figure out how to "enable" them as a user.

_________

http://www.ssllogic.com/
Last edited on
thx computergeek01, matsom, ssllogic.

wel, matcom & ssllogic has got my point..
I can say that I am at the end part of this assignment, but still I need you all guys!

can you tell me how to change that [edit control] to [owner defined text]?my teacher has given me this assignment without telling me this thing and to submit tommoro.

please describe using steps, that will be great for me!
I know I will have to assign the same ID to this.but how?

again, thank you all!
As I wrote earlier -use the resource editor to edit the .rc/.res file.

To do it manually (warning, not responsible for making your program explode), open the file in notepad:
i. put the [owner defined text] inside "" in your code
ii. add ES_READONLY to ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP

FYI:
1. ES_ means 'edit control style' ref. http://msdn.microsoft.com/en-us/library/czada357(v=vs.80).aspx
2. WS_ means 'window control style' ref. http://msdn.microsoft.com/en-us/library/6e36b89f%28v=vs.80%29.aspx
3. the numbers 77, 44, 65, 12 refer to the position and size of your control

LOL edited in response to hanst's comment
Last edited on
matsom- you will hardly make the program explode by editing rc files, unless you do something really crazy with them.
EDITTEXT "WWW.EXAMPLE.COM", 1005, 77, 44, 65, 12, ES_AUTOHSCROLL | ES_READONLY


this is what i have made, I need to create a value variable "www.example.com".
it does not show this value, why?
msdn wrote:
EDITTEXT id, x, y, width, height [, style [, extended-style]]
The following example demonstrates the use of the EDITTEXT statement:
Copy

EDITTEXT 3, 10, 10, 100, 10



What you wrote doesn't really follow that definition. Instead, call SetDlgItemText when you create the dialog: http://msdn.microsoft.com/en-us/library/ms645521%28v=VS.85%29.aspx
Last edited on
you got me wrong dear!

It is more like this!

EDITTEXT "", ID, x, y, width, height, styles


or may be i should replace the use of EDITTEXT into some other to define value for ID?
That quote was from MSDN. If I had to decide whether Microsoft or you has more authority regarding how microsoft components are defined, I wouldn't have a hard time doing so.
Last edited on
I guess you are going to help me NOT judge me!
Yes and I already did so. I've told you exactly what you do wrong, and how you do it right. If you would please excuse me now, I don't feel like getting bitched at by people who can't stand being corrected.
Last edited on
Topic archived. No new replies allowed.