Normal Topic Visibility () and Search mode using entry with F7 (Read 822 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Visibility () and Search mode using entry with F7
Jun 10th, 2012 at 8:28pm
Print Post Print Post  
Universal Search is very powerful and useful it in some applications. I usually like to close the command tree. So, placing the UniversalSearch command button that is visible only in Search mode (@Mode ( ) = 2 ),   I have placed the following command on Form Open event to achieve that.

Code
Select All
If @Mode ( ) = 2 then
	{
		Visibility (UniversalSearch, 1)
	}
	Else
	{
		Visibility (UniversalSearch, 0)
	}
ForceRedraw ( )
 



The problem is when I use F7 key to go to Search mode from Search and Update mode, that is from @Mode ( ) =1 to @Mode ( ) = 2,  The UniversalSearch commandButton does not show up.

What do I have to change in the code to work in order to see UniversalSearch command button only in Search mode and it should also work with F7?
« Last Edit: Jun 10th, 2012 at 11:03pm by Bharat_Naik »  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Visibility () and Search mode using entry with F7
Reply #1 - Jun 10th, 2012 at 9:29pm
Print Post Print Post  
You may be over-thinking it using @Mode. All you need to do is turn on visibility in On Retrieve Spec Open, and turn it off in On Form Entry. So...

Add this to the On Retrieve Spec Open event:
Visibility(UniversalSearch, 1)

And add this to the On Form Entry event:
Visibility(UniversalSearch, 0)
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Visibility () and Search mode using entry with F7
Reply #2 - Jun 10th, 2012 at 11:02pm
Print Post Print Post  
Thanks Carl. It is working as I want it to. Isn't @Mode () 2 is the same as Search or Retrieve Spec ?  If the command is conditional on Form Open in @Mode ( ) 2, is the same as On Retrieve Spec Open event?  I got lost with that logic !!  May be you are right, I got too much tied up with @mode. Thanks.
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Visibility () and Search mode using entry with F7
Reply #3 - Jun 10th, 2012 at 11:21pm
Print Post Print Post  
Bharat_Naik wrote on Jun 10th, 2012 at 11:02pm:
Isn't @Mode () 2 is the same as Search or Retrieve Spec ?

Yes, but you must have had your code in the On Form Entry event. That event does not execute when you open the form in Search mode, so only the "Else" portion of your code ever got a chance to execute.


Quote:
If the command is conditional on Form Open in @Mode ( ) 2, is the same as On Retrieve Spec Open event?

No. Only code in the On Retrieve Spec Open event will execute when the form opens in Search mode.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Visibility () and Search mode using entry with F7
Reply #4 - Jun 10th, 2012 at 11:24pm
Print Post Print Post  
Thanks Carl for explanation.  Appreciate your help.
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Visibility () and Search mode using entry with F7
Reply #5 - Jun 10th, 2012 at 11:40pm
Print Post Print Post  
I should point out that when I say only the On Retrieve Spec Open event will execute, I mean compared to the On Form Entry event. There are other events that will execute in Search mode, like On Draw, On Reveal, and On Hide.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged