Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for Control's Focus 2

Status
Not open for further replies.

Mugs321

Programmer
Jan 31, 2007
49
CA
Hey all,
I'd imagine this is a simple question but I haven't been able to find anything on it.

I have a 'remove' button that should be disabled if a certain listbox is empty. The problem is, if the remove button has focus at the time of being disabled (like if I use the button to remove the last item in said listbox) I get an error stating that I cannot disable a control that has focus.

Is there any way to check if a certain control has focus so I can change the focus to another control prior to disabling the button?

Thx,
Dave
 
Try this:

Code:
If screen.activecontrol.name="YOURCONTROLSNAME" then
  thiscontrol.setfocus
  YOURCONTROLSNAME.ENABLED=FALSE
END IF

Somthing along those lines should get you started.

I tried to have patience but it took to long! :) -DW
 
Hello:

Use the "ActiveControl" method. That will show which control has the focus. Its in the help.

Regards
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top