How to create text field in form to be highlighted when selected?

jamesave

New member
Local time
Today, 02:51
Joined
Apr 26, 2020
Messages
25
I come across to the northwind 2.0 database (Developer version). In the frmProductDetail form, the txtProductID text field has the property of Back Color is "No Color" and the Back Style is "Transparent". There is no event associated with this field either. But when a user click on this field, the field is highlighted. There is also no conditional formatting set for this field as well.

Seems like i can't post a link about "highlight-current-control" page that I am reading to find out how this work.
 
Not in front of a computer now, but if the back color is transparent, then the highlighting might be happening on a control behind it. Can you check that?

Sent from phone…
 
actually the Back Color is Yellow.

try this, change the Back Style To Normal and change the Back Color to anything.
then change the Back Style again to Transparent.
that is how he did it without CF.
 
I believe it is indicating that the control is locked, but I too cannot see how. :(
 
actually the Back Color is Yellow.

try this, change the Back Style To Normal and change the Back Color to anything.
then change the Back Style again to Transparent.
that is how he did it without CF.
Neat trick.(y)
 
Seems like i can't post a link about "highlight-current-control" page that I am reading to find out how this work.

True, you can't. Due to unfortunate incidents with spammers, we put a limit on posting links for new members. Sorry, but the spam was getting a bit thick and we had to try to control it within the limits of the 3rd-party software running the forum. Limiting links was available so it is what we used. We weren't picking on you; it applies to all new members.
 
But when a user click on this field, the field is highlighted.
Not exactly.
I think this is what you are referring to:
1746107713048.png


In this case I started a new record, entered a Product Description, and clicked the Record Selector to cause the record to be saved.
Then the validation code intervenes, stops the Save action, and highlights the required fields that are null.
The technique is documented in this page: see the Validation section under Programming Orders. When you delve into the code (modValidation) you will see we DO use Conditional Formatting in list-style (sub-)forms, and the BackStyle/BackColor properties for standard forms like this one.
 
I am referring to this highlight when the Product ID field is selected, not on a new record but on an existing one. seems like the background itself is white

Screenshot 2025-05-01 212034.png

I just skim over modValidation, it seems to work for the fields that need to be filled in. but I can't find any event that will trigger this txtProductID field.
 
I am referring to this highlight when the Product ID field is selected, not on a new record but on an existing one. seems like the background itself is white

View attachment 119659
I just skim over modValidation, it seems to work for the fields that need to be filled in. but I can't find any event that will trigger this txtProductID field.
It has already been explained how that was done? :(

1746109842627.png
 
It has already been explained how that was done? :(

View attachment 119660


Ah I think I understand now thanks Gasman and arnelgpp

the link that I was trying to put here is talking about it, but I wasn't sure how it behaviour (quirk?) to this in northwind sample. In the property, the back color is "no color". but once the back style is change to "normal", the back color change to #FFF200 which is yellow
 
True, you can't. Due to unfortunate incidents with spammers, we put a limit on posting links for new members. Sorry, but the spam was getting a bit thick and we had to try to control it within the limits of the 3rd-party software running the forum. Limiting links was available so it is what we used. We weren't picking on you; it applies to all new members.
Thank you.. Noted!
 
You found an imperfection in NW. The control should have BackStyle=Normal, and BackColor=Background 1.
I'll add it to the fix list for v2.5 (if ever).
 
I come across to the northwind 2.0 database (Developer version). In the frmProductDetail form, the txtProductID text field has the property of Back Color is "No Color" and the Back Style is "Transparent". There is no event associated with this field either. But when a user click on this field, the field is highlighted. There is also no conditional formatting set for this field as well.

Seems like i can't post a link about "highlight-current-control" page that I am reading to find out how this work.
How do you know there is no event for this control? Are you sure? It seems like gotfocus , enter would be the ones to look for.
 
It could also be in pretty much any other control or form's event, such that it fires frequently and checks if that control has focus.
Would be weird, but is possible.
 
This was created by professionals, not amateurs :), though I get your point.
 
I can't post the link here, but there is an explanation from isladogs website; search for "highlight required fields"
 
How do you know there is no event for this control? Are you sure? It seems like gotfocus , enter would be the ones to look for.
This is one thing that I tried to grasp when looking inside the Northwind DB.. I simply look at the event list of the property sheet when selecting this field in design view. There is nothing in any of the event. Then I looked at the code for this form and search for txtProductID which is the name of this text field. Nothing show up there too.
 
I can't post the link here, but there is an explanation from isladogs website; search for "highlight required fields"
I'll post the link for you. I hope this is the right one.
 

Users who are viewing this thread

Back
Top Bottom