How to change "input field" code in dialogue.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 21

Thread: How to change "input field" code in dialogue.

  1. #1
    Join Date
    Mar 2011
    Posts
    10

    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?

  2. #2
    Join Date
    Mar 2011
    Posts
    10

    Re: How to change "input field" code in dialogue.

    please specify with quotes as I may understand!

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,272

    Re: How to change "input field" code in dialogue.

    Are you using the VC++ express version? If not, why don't you use the dialog editor instead of hand editing the rc file.

  4. #4
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: How to change "input field" code in dialogue.

    Quote Originally Posted by dilawar12 View Post

    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.
    As suggested by Arjay you should use resource editor if you are not using express edition.

    And for setting some default text to edit box use ::SetWindowText api.
    And for disable user to edit that you can disable the edit box by ::EnableWindow(hEdit, FALSE)
    ◄◄ hypheni ►►

  5. #5
    Join Date
    Mar 2011
    Posts
    10

    Re: How to change "input field" code in dialogue.

    well guys I am newbie in MVC, so I am in learning process.

    as far as you both suggested, I appreciate your concern.
    But I am in puzzle, my friend has given me this task as challenge [bcz I accepted it :S]
    and I dont know what you just mentioned:
    And for setting some default text to edit box use ::SetWindowText api.
    And for disable user to edit that you can disable the edit box by ::EnableWindow(hEdit, FALSE)
    PLEASE ELABORATE IT LIKE A TUTOR!
    btw, I got resource editor, having dialogue edit screen on here, but dont know how to do that!

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,081

    Re: How to change "input field" code in dialogue.

    Quote Originally Posted by dilawar12 View Post
    well guys I am newbie in MVC, so I am in learning process.

    as far as you both suggested, I appreciate your concern.
    But I am in puzzle, my friend has given me this task as challenge [bcz I accepted it :S]
    and I dont know what you just mentioned:


    PLEASE ELABORATE IT LIKE A TUTOR!
    btw, I got resource editor, having dialogue edit screen on here, but dont know how to do that!
    This board will help you when you're stuck with specific problems. It's not intended to take the place of a class or tutorial. The bookstore is full of books that will explain the fundamentals. Work through one of them and get a basic understanding then post back. You can't possibly learn to program by asking such basic questions as how to use the resource editor, nor is it reasonable of you to expect somebody to write such a tutorial when so many of them already exist.

  7. #7
    Join Date
    Mar 2011
    Posts
    10

    Re: How to change "input field" code in dialogue.

    You could have write just " DONT POST", I think!

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,081

    Re: How to change "input field" code in dialogue.

    Quote Originally Posted by dilawar12 View Post
    You could have write just " DONT POST", I think!
    I didn't say don't post. I said don't expect somebody to write a tutorial for you. If you really want to learn, the best thing to do is work through a book. That's sound advice, and substantially more useful than just telling you not to post. Seems like your expectations are a little off is all.

  9. #9
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,272

    Re: How to change "input field" code in dialogue.

    Quote Originally Posted by GCDEF View Post
    I didn't say don't post. I said don't expect somebody to write a tutorial for you. If you really want to learn, the best thing to do is work through a book. That's sound advice, and substantially more useful than just telling you not to post. Seems like your expectations are a little off is all.
    GCDEF is right on - it's not about 'not posting', it's about approaching the learning in the most efficient manner.

    If we thought that helping you every little step of the way was going to get it done, many of us would do it. The fact is that at the beginning of learning a language, you need to put the time in to learn the basics. Short of taking a class, no one can really help with that. If you can't take a class the next best thing is to find an online tutorial and start working through it.

    As GCDEF has already mentioned, as you encounter issues when working through the tutorial feel free to post specific questions.

    Good luck to you.

  10. #10
    Join Date
    Mar 2011
    Posts
    10

    Re: How to change "input field" code in dialogue.

    well if this is the case, then you guys might help in below situation!

    I am trying to give a default value for a program to run, for this I have changed the edit control field into static control field in resource editor.

    but when I run the program, it shows the default field as read only but not showing the actucal value that I have given.

    I think I am putting the caption value to this, NOT the actual value!
    if this is correct, then help me atleast NOW!!!

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,081

    Re: How to change "input field" code in dialogue.

    Quote Originally Posted by dilawar12 View Post
    well if this is the case, then you guys might help in below situation!

    I am trying to give a default value for a program to run, for this I have changed the edit control field into static control field in resource editor.

    but when I run the program, it shows the default field as read only but not showing the actucal value that I have given.

    I think I am putting the caption value to this, NOT the actual value!
    if this is correct, then help me atleast NOW!!!
    STOP SHOUTING DEMANDS!!!! That isn't going to help.

    Part of the problem is you don't even have the terminology down to explain yourself properly. What does "default value for the program to run" mean? What does "putting the caption to this" mean? What does " default field as read only but not showing the actucal value that I have given" mean? Shows it where?

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,272

    Re: How to change "input field" code in dialogue.

    Quote Originally Posted by dilawar12 View Post
    well if this is the case, then you guys might help in below situation!

    I am trying to give a default value for a program to run, for this I have changed the edit control field into static control field in resource editor.

    but when I run the program, it shows the default field as read only but not showing the actucal value that I have given.

    I think I am putting the caption value to this, NOT the actual value!
    if this is correct, then help me atleast NOW!!!
    In MFC (not MVC as mentioned earlier), what you want to do is to create a value variable by right clicking on the edit or static control in the resource editor and choose "Add Variable". Under Category:, choose 'Value'. For variable type, choose 'CString'. Give the variable a name and press OK. In OnInitDialog, set the variable that you created to the string that you desire.

  13. #13
    Join Date
    Mar 2011
    Posts
    10

    Re: How to change "input field" code in dialogue.

    If I dont know YOUR language, that doesnt mean that I am nothing!!!


    Below is the code!
    {
    EDITTEXT "", 1051, 450, 79, 72, 14, ES_AUTOHSCROLL
    EDITTEXT "", 1052, 403, 102, 72, 14, ES_PASSWORD | ES_AUTOHSCROLL
    LTEXT "Acc. Number", 1062, 387, 58, 55, 10
    LTEXT "Acc. Password", 1063, 419, 20, 55, 10
    CONTROL 329, 329, "STATIC", SS_BITMAP | SS_REALSIZEIMAGE, 0, 0, 167, 154
    EDITTEXT "WWW.EXAMPLE.COM", 1005, 77, 44, 65, 12, ES_AUTOHSCROLL | ES_READONLY
    EDITTEXT "", 1055, 77, 59, 65, 12, ES_AUTOHSCROLL
    EDITTEXT "", 1002, 77, 74, 65, 12, ES_PASSWORD | ES_AUTOHSCROLL
    AUTOCHECKBOX "", 1059, 79, 91, 10, 10, BS_LEFT
    AUTORADIOBUTTON "cmdLogin", 1064, 43, 124, 38, 12, 0x00000002
    AUTORADIOBUTTON "cmdExit", 1065, 108, 126, 38, 12, 0x00000002
    LTEXT "Username", 1060, 25, 59, 48, 10
    LTEXT "Password", 1061, 27, 74, 44, 12
    LTEXT "Domain", 1082, 25, 44, 52, 12
    LTEXT "Save", 1084, 59, 91, 18, 10
    }

    find picture attached!
    In picture, you will find BEFORE and AFTER difference!
    Now I am trying to put WWW.EXAMPLE.COM for ID#1005 in that whatever you call that thing, field, area, input box, control box... which is not visible in AFTER picture!
    I am not here to determine myself!
    Attached Images Attached Images  

  14. #14
    Join Date
    Mar 2011
    Posts
    10

    Re: How to change "input field" code in dialogue.

    Thank you so much ARJAY for that you understood my language!
    the thing is that I am not a programmer like you people, I am webdeveloper and I have a project to complete, in which making of this program is attached, which just logins user and shows his account for a perticular domain, thats all!
    I have made 90% of the program by the help of google! rest of % is currently on this forum!
    regret to state here but here I found some people, who want others to be like them!

  15. #15
    Join Date
    Aug 2006
    Posts
    132

    Re: How to change "input field" code in dialogue.

    So, if I understand you correctly, you want the phrase "www.example.com" to appear in the grayed-out (read-only) edit box labeled "Domain". Is that correct?

    Have you tried setting initial text for any of the other edit boxes on the dialog? Have you tried removing the ES_READONLY style?

    I don't know anything about how to fix your problem. I've just found that sometimes it helps me to try to do the same thing in slightly different ways until I find one that works.

    Also, could you please tell us what compiler and development environment you're using? That is, are you using Microsoft Visual Studio 2005? 2008? 2010? Something else entirely?

    RobR

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center