Solved

WM_NEXTDLGCTL to hi-lite edit control

Posted on 1998-01-16
9
1,349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 35
Magento Indexing 1 131
CSS display:none AND display:block on same element 3 121
Randomize in Owl Carousel v1.3.2 6 132
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to count occurrences of each item in an array.

732 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