Solved

WM_NEXTDLGCTL to hi-lite edit control

Posted on 1998-01-16
9
1,320 Views
Last Modified: 2013-12-26
I am trying to highlite an edit control when the user first enters the dialog box to indicate that a field must be filled in. I have tried many many ways to accomplish this but none successful. Last input I got from here was to use WM_NEXTDLGCTL. WM_NEXTDLGCTL states that, unlike SETFOCUS, it modifies the border around the control. It also says to use PostMessage. I assume that this means that the background is microsoft blue and the text is white.

Well this is what I am doing;  //some of this is psuedo code

RESPONSE_TABLE
  EV_WM_NEXTDLGCTL
END
Constructor {
 pCustName = new TEdit(this, IDC_IN_NAME);
 // other controls instantiated
}

void Dialog::SetupWindow{
   TDialog::SetupWindow();
   PostMessage(WM_NEXTCLGCTL, ID_IN_NAME, 1);
};

void Dialog::EvNextDlgtCtl(UINT, hctOrDir, UINT isHctl){
   pCustName->SetText("Enter Name");
};

The dialog displays with the text Enter Name without the text being highlited. What am I doing wrong? Also, what are the parameters to EvNextDlgCtl??
0
Comment
Question by:dutch
  • 5
  • 4
9 Comments
 

Author Comment

by:dutch
ID: 1299545
Adjusted points to 200
0
 

Author Comment

by:dutch
ID: 1299546
No Takers????
0
 
LVL 3

Accepted Solution

by:
JPM earned 250 total points
ID: 1299547
HI!

There is a simple way to do the job :

- declare a TEdit* xxx  member in your dialog derived class

- in the constructor of that class, you have to put :
       xxx = new TEdit(..........);

- in SetupWindow of the dialog class
        ......
        xxx->SetFocus();
- in destructor :   delete xxx;

et voilà !

I usually do this for all my forms ( for example an edit field has been reserved for storing keys )

Hope this helps.
Jean-Paul
0
 

Author Comment

by:dutch
ID: 1299548
Sorry, but it didn't work. First, to make sure everyone understands the question, I want the text "Enter Customer Name" highlited (blue background, white letters) when the dialog is instantiated. This is like what happens to your userid if you enter the wrong password logging in to this site.

the code is as follows;
in header file

   protected:  
      TEdit* pCustName;

in CPP file

CustDialog::CustDialog(TWindow* Parent)           //constructor
                      :TDialog(Parent, IDD_CUST_DIALOG){  
   SetCaption("Customer Data");
   pCustName = new TEdit(this, IDC_IN_NAME);
};

void CustDialog::SetupWindow{
   TDialog::SetupWindow();
   pCustName->SetText("Enter Customer Name");
   pCustName->SetFocus();
   // i have tried with either one being first - no difference
};

CustDialog::~CustDialog{
   delete pCustName;
};

The dialog comes up with the TStatic control Customer Name and the TEdit control next to it with the text "Enter Customer Name". However it is not highlited - the text is in black and the background is white. Everything else does work. I can get the text and file for later use.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:JPM
ID: 1299549
That's strange!

In my program, I almost wrote the same code as yours ( SetDlgItemText instead of SetText ) to get the name of a project
and it works!
It sounds like something has been overwritten!

What about  EV_WM_SETFOCUS, EV_WM_KILLFOCUS ?





0
 
LVL 3

Expert Comment

by:JPM
ID: 1299550
If you wish, ask the supervisor for my E-mai! address and I 'll send you an Edit derived class ( with effects ) so you could try it.
Bye
        Jean-paul

0
 

Author Comment

by:dutch
ID: 1299551
Jean-Paul, I did not try to set/kill focus by placing a WM_SETFOCUS message on the queue (I assume you mean using the PostMessage function). I will be on a business trip until this weekend and wil not have the time to test this out. If I figure out how to send a note to the adminstrator to get you id while I am in this session, I will do that. Thanks...
0
 
LVL 3

Expert Comment

by:JPM
ID: 1299552
To get my ig:
 get to the Expert-Exchange 's main window
 toggle FAQ
 #14 How to contact....
Send a message

I have tried it this way!

 
0
 

Author Comment

by:dutch
ID: 1299553
Thanks...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Consuming WCF service from Java with callback contract 5 255
Format results with PHP 3 68
Visitor to Web site (Log showing Strange IP Address) 9 87
.php tree directory? 5 56
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now