Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Really appreciate your site. Really good site for learning what others do when they run into problems. You guy's are great!!!..."

Geography

Where in the world do Tek-Tips members come from?
foxmuldr2 (Programmer)
15 Jun 12 10:44
1) Go into VFP9, in a temp directory, create a new proj1 project
2) Add a main.prg that simply has "DO FORM frmMain" and "READ EVENTS"
3) Create a form frmMain which is set to auto-center, ShowWindow = 2 (As Top Level Form). You can add labels or input boxes if you like, not required.
4) Add init code to frmMain which is "_vfp.visible = .f."
5) Add unload code to frmMain which is "_vfp.visible = .t." and "CLEAR EVENTS"

Build the project and type "DO PROJ1" from the command window.

You'll note that the form goes to the very back of every other window that's open, and that the window itself does not have keyboard focus.

-----
Does anybody know why this is? Or how to programmatically make it come to the top/front of z-order and have keyboard focus?

Best regards,
Rick C. Hodgin
MikeLewis (Programmer)
15 Jun 12 10:56
Rick,

This is a very commom problem.

My solution is as follows:

CODE

* Put this in the form's Init
DECLARE INTEGER SetForegroundWindow IN WIN32API INTEGER
SetForegroundWindow(thisform.HWnd)
CLEAR DLLS "SetForegroundWindow"

There might be a better way, but this is the way I've always handled it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy

MikeLewis (Programmer)
15 Jun 12 10:59
In my previous post, I didn't intend the code to be double-spaced. In fact, the whole post seemes to have acquired some extra spacing between the paragraphs. Are other people seeing this, or is it something in my browser? Is there anything I should do to avoid it?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy

foxmuldr2 (Programmer)
15 Jun 12 10:59
That did it. I've run into this issue for years and have never taken the time to track it down. Thanks!

Best regards,
Rick C. Hodgin
MikeLewis (Programmer)
15 Jun 12 11:04
You're welcome, Rick. As I said, it's a common problem. I used to get it in my login forms until I added the relevant code.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy

foxmuldr2 (Programmer)
15 Jun 12 11:13
Mike, looks single-spaced to me. However, when I copied and pasted it, I had to manually add line breaks.

One trick I've learned to help fix that is to take the content from the original source, paste it into Notepad or some non-formatting / non-syntax-highlighting form, and then re-copy-to-clipboard again, and then paste into the destination.

Horrible that it's required, but I've noticed it fixes a lot of stuff. Be careful though because some notepad-like apps will add hard carriage returns at margins.

Best regards,
Rick C. Hodgin
317-879-6374
foxmuldr2 (Programmer)
15 Jun 12 11:14
I didn't mean to post my phone number. It's habit. smile

Best regards,
Rick C. Hodgin
MikeLewis (Programmer)
15 Jun 12 12:30
Actually, looking at all the recent threads, I've been seeing double-spacing in the code, and extra spaces between paragraphs.

But it seems to be browser-specific. I usually use Firefox, but when I switch to IE, it looks fine.

I wonder why it's suddenly started to happen.

Oh, well. Never mind. There are more important things to worry about.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy

jrbbldr (Programmer)
15 Jun 12 15:36
Keep in mind that the Tek-Tips forum developers are continuing to work on modifications to the forum and how it works.

As they do 'things' crop up from time to time.
Most are reported quickly and are addressed as soon as they can get to it.

Good Luck,
JRB-Bldr
TamarGranor (Programmer)
15 Jun 12 16:27
One other suggestion. Rather than using _VFP.Visible = .F., use a Config.FPW file with the line:

SCREEN=OFF

That way, you don't even get a flash of the main VFP window.

Tamar
OlafDoschke (Programmer)
16 Jun 12 4:37
@Rick, yes, I can confirm this.

And with Tamars way of hiding the screen via the SCREEN=OFF option in a config.fpw it works without using the SetForegroundWindow API. So of course I second that. I've never had the problem, perhaps just I did it like that from the start. I wrote a FAQ (my only one, my bad), which is creating a top level form in a very similar way, but using that config.fpw option.

FAQ184-6512: How To Make a Single-Form-Application

I had problems getting out the code with firefox, IE and chrome even shows the code area without any linebreaks. Therefore you might instead try my code paste at pastebin: http://pastebin.com/raw.php?i=Pge8hKdg

Specify the directory, in which the project is generated in the first line and the rest will create the pjx, prg, form and compile the exe.

@Mike: In regard to the forum quirks: Yes, this is really getting worse, since Tek-Tips has changed it's forum editor. And copying out code has been a problem even longer, but at least it worked in some browsers. This time I only got code without any line breaks in each browser I tried. I finally took it from my pc.

Bye, Olaf.
foxmuldr2 (Programmer)
16 Jun 12 10:55
Tamars, Olaf,

Thanks for the config.fpw suggestion. smile

Best regards,
Rick C. Hodgin

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close