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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stand Alone Application

Status
Not open for further replies.
Apr 25, 2002
156
GB
Hi there

I have created a stand alone application as an exe and i have it as a top level form with the main foxpro window hidden
In the main program i have the following lines....

_SCREEN.Caption = 'Generic - Application'
_SCREEN.Closable =.F.
_SCREEN.WindowState = 2
SET SYSMENU TO && disables the main Visual FoxPro menu bar.
DO FORM switchboard
READ EVENTS

In the init of the form called Switchboard i just have the normal lines as below.....

** CLOSE DATABASES

SET EXCLUSIVE ON
SET DATE BRITISH
SET CENTURY ON
SET SAFETY OFF
SET TALK OFF
SET MULTILOCKS ON
SET EXACT ON
SET NEAR OFF
SET DELETED ON

**-- This loads the menu
do PostalMenu.mpr with this

gc_user = UPPER(ALLTRIM(RIGHT(SYS(0),LEN(ALLTRIM(SYS(0)))-AT('#',SYS(0)))))
gc_pcname = UPPER(LEFT(SYS(0),AT('#',SYS(0))-1))

thisform.pCDetails.Value = gc_pcname
thisform.userDetails.Value = gc_user

THISFORM.BACKCOLOR = RGB(220 ,225,255)


Application.Visible = .F.
thisform.Userdetails.SetFocus()

With this i get the form showing but there is no way that i can get the form called Switchboard to have the focus. The title bar remains grey - whcih means the form is not active -

What am i missing .....

I have been trying allsorts to get this to work

Rdrunner
 

In the init of your form, set the focus on a textbox.
Thisform.text1.setfocus()


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,

I already have a thisform.userdetails.setfocus() in the init of the form and the title bar still remains greyed out

Does it have to be a textbox that receives the setfocus() event ?

IF not then what else is there to try ????

Regards

Murray
 
try some stuff later on in the event chain...

Like put:

thisform.activate()

...or...

thisform.userdetails.setfocus()

...in the activate event of the form.

I'm assuming here that you are able to click on the form and give it focus and do whatever, but that you are having trouble getting the form to activate when it first comes up right?

If the solution I propose above doesn't work then there is an API call that will set focus to your form given the it's HWND.


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
rdrunner40

In the init?
_screen.ActiveForm.command1.SetFocus

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

It doesn't sound like the Switchboard form is the ActiveForm of the _screen, since the tilebar is grayed out.

rdrunner40,
when all else fails try a little brute force using API call:

declare integer SetForegroundWindow in win32api long lnhWnd
=SetForegroundWindow(thisform.hwnd)


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Although all the methods above should work, most of them don't. Fortunately, there is a simple solution. Just make sure you have a config.fpw with at least one line:
SCREEN = OFF. Try with and without it and you'll see the difference. In my case, it works every time.
Good luck!
 
csandu00,

Although all the methods above should work, most of them don't.

Which of the above suggestions did you discover worked in addition to your own? I am curious for future reference. Thanks.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Hi all

Thanks for the quick help yesterday and yes this has finally put to rest a issue which has been bugging me for a while

The prompt replies were helpful and be sure the help was appreciated

Keep up thre good work

Rdrunner40


Murray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top