×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!
  • Students Click Here

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem Caption On Title Bar

Problem Caption On Title Bar

Problem Caption On Title Bar

(OP)
Dear Team,
I want to create a form using the windowstate=2 property. Please explain why the caption in the title bar disappears on the form when it is run. What is the solution to keep the caption active using mode widowstate=2. Thank you for your help.

The code as below :
PUBLIC oForm
oForm=CREATEOBJECT([MyForm])
oForm.Visible=.T.

DEFINE CLASS MyForm AS Form
BorderStyle=3
showWindow=2
TitleBar=1
Caption ="EMPLOYEE MASTER"
desktop=1
WINDOWSTATE=2
ENDDEFINE
RETURN

 

RE: Problem Caption On Title Bar

There is nothing in the code you posted to prevent the caption from appearing. There must be some other code somewhere that is causing the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

Quote (Mike Lewis)

There is nothing in the code you posted to prevent the caption from appearing.

Mike, when I run the Code, a Form is opened "Full Screen Size" with no Caption. When I hit "Restore Down" Button the Screen reduces in size and the Caption is displayed.

Regards,

David.

Recreational user of VFP.

RE: Problem Caption On Title Bar

David,

I'm not seeing the same as you. I see the full-size (maximised) form, but with the title bar and caption ("EMPLOYEE MASTER") completely visible.

You mentioned the "Restore Down" button. If that is the button in the top-right of the form, between the Close and Minimise buttons, then that means that your title bar is visible (as expected). So you are seeing the title bar without any text in it. Is that correct?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

Quote (Mike Lewis)

You mentioned the "Restore Down" button. If that is the button in the top-right of the form, between the Close and Minimise buttons, then that means that your title bar is visible (as expected). So you are seeing the title bar without any text in it. Is that correct?

Yes Mike, the Maximised Screen does not display the Caption although the Title Bar is displayed. The Caption is displayed when the button in the top-right of the form, between the Close and Minimise buttons is pressed.

EDIT - If I click on my other (Second Monitor) the "Caption" is displayed on the VFP Screen.
Regards,

David.

Recreational user of VFP.

RE: Problem Caption On Title Bar

That's very strange. I can't see any reason for the title bar to appear but without the caption. I've never seen that before.

David and Ariswan, are you seeing this behaviour in any other VFP forms? What about forms in other applications? What happens if you set the WindowState to 0 or 1; does that makes any difference? Does the caption appear as a property of the form object if you run the form in the debugger?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

Quote (Mike Lewis)

What happens if you set the WindowState to 0 or 1; does that makes any difference?

Caption is displayed in WindowState set to 0 or 1. Form is reduced in size.

Regards,

David.

Recreational user of VFP.

RE: Problem Caption On Title Bar

Quote (David Higgs)

Caption is displayed in WindowState set to 0 or 1.

Sorry, David, I should have said ShowWindow rather than WindowState. Can you try it with ShowWindow = 0 and WindowState = 2.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

Quote (Mike Lewis)

Can you try it with ShowWindow = 0 and WindowState = 2.

That works fine.

Regards,

David.

Recreational user of VFP.

RE: Problem Caption On Title Bar

So it is only in top-level forms that the problem occurs. Sorry, I still can't suggest anything. I thought it might be something to do with the screen resolution, or perhaps with the positioning of the form in some way. That might have been plausible if the entire title bar was invisible, but it wouldn't explain the title bar appearing without the caption.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

By the way, David and Ariswan, what version of VFP are you using? And what version of Windows?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

Mike and David
I am seeing the same issue as David sees. Windows 10 (1903) VFP9 SP2 (7423)
On a side note the same code works correctly with VFPA (VFP advanced 32 bit)


If you want to get the best response to a question, please check out FAQ184-2483: How to get the best response from the forum first.

RE: Problem Caption On Title Bar

Quote (Mike Gagnon)

Windows 10

I've been testing this with Windows 7. So, could it be a Windows issue?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Problem Caption On Title Bar

Windows 10 & VFP 9 SP2.

Regards,

David.

Recreational user of VFP.

RE: Problem Caption On Title Bar

I see the problem, too, on Windows 10.

It reminds me of the problems we had in VFP Forms with the way Vista Aero changed some rules. And Calvin Hsia's fix for that with the DoCreate property:
https://blogs.msdn.microsoft.com/calvin_hsia/2007/...

Arisswan2007,

unfortunately, the DoCreate hack won't fix your problem. I also checked whether the problem disappears when creating a visual form (SCX) and when compiling as an EXE, but it doesn't.
What also seems strange is that the titlebar doesn't get painted white as a usual top level form titlebar on Windows 10 is.

A straight forward way out seems to be to set the caption in the Paint event:

CODE

Public oForm
oForm=Createobject([MyForm])
oForm.Show()

Define Class MyForm As Form
   ShowWindow = 2
   Desktop = .T.
   WindowState =2

   Procedure Paint()
      This.Caption = "EMPLOYEE MASTER"
   Endproc
Enddefine 

There are some other things I straightened:
a) no need to set properties to a value, that's their default anyway, BorderStyle=3 is default
b) Desktop isn't a property that switches between 0 and 1, it's .T. or .F., respectively.
Titlebar is the only property that is strange from the VFP perspective.
c) You call the form's Show(), you don't set Form.Visible = .T.

All this is no problem when you don't set the WindowState to maximized, so it seems to be related to that. A form starting as maximized isn't painted correctly.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Problem Caption On Title Bar

(OP)
Thank you for the response...
The code from Olaf answers this problem.
I have tried through the code screen (.prg) and form (scx), and the caption can be displayed in the title bar.

Regards

CODE :
Public oForm
oForm=Createobject([MyForm])
oForm.Show()

Define Class MyForm As Form
ShowWindow = 2
Desktop = .T.
WindowState =2

Procedure Paint()
This.Caption = "EMPLOYEE MASTER"
Endproc

Enddefine

RE: Problem Caption On Title Bar

You might want to organize this differently when you plan to add info to the titlebar caption, eg the name of an employee picked from a list after the form has started. Because Paint() is an event that doesn't just run once at the initialization. I first tried Load() and Init(), but they don't work. Activate(), too, and it also runs more than once, if a user switches between forms.

Now, as you reposted the code with the marked change, I think you want to help future developers to find the solution fast. The feature used for that here on Tek-Tips is marking the answering post with a start ("Great post").

And, by the way, I see all the discussion about @CLASS in your first post to Tek-Tips drowned to welcome you.


While the @CLASS behavior was unfortunate, that was by design. This time you actually found a new bug, if only a minor one. So far I only had legacy Windows theme style within the IDE. After building and running an EXE, the current Windows-style applies. The difference is it involves the VFP9r.DLL and English resource DLL instead of the VFP9.exe. Maybe it's within my layout settings. But I guess that'll come up more often and should get a better workaround than that to cope with changing captions.

Bye, Olaf.


Olaf Doschke Software Engineering
https://www.doschke.name

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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! Already a Member? Login

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