Solved

WM_NEXTDLGCTL to hi-lite edit control

Posted on 1998-01-16
9
1,314 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
RSS Feeds--IE 13 150
CSS (line height?) issue 2 56
website content maintenance 3 57
Problem to echo 6 53
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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

13 Experts available now in Live!

Get 1:1 Help Now