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

Maximized forms with Windowstate = 2 hide Taskbar 2

Status
Not open for further replies.

Ris1

Programmer
Dec 8, 2017
26
IN
I have forms which were designed for 1024 * 768 resolution. Now I want forms to work for any resolution , so I am setting anchor properties of control. But the problem is as I set Windowstate = 2 in my main form, it covers whole screen including taskbar. How can I avoid that.
 
In task bar options don't turn on the the option to automatically hide the taskbar, and maximsing aVFP form will only use the desktop space minus the taskbar.

If you turn on that feature of the taskbar it means you want it that way, so applications can use the full desktop and that's what they'll do then,moving the mouse down will show the taskbar overlapping the VFP _screen or your top level form.

That's not a VFP problem and actually there is nothing to solve, everything is as it should be.

Bye, Olaf.
 
I would add that whether to auto-hide the taskbar or not should be a decision for the end-user. Your application should respect that decistion, whichever it is.

In the same way, the user might choose not to maximise your app's main window. Even though you set WindowState to 2, the user might choose to un-maximise it.

The point is that you can't make any assumptions about the size of your main window (except perhaps to impose a minimum size below which it is not practical to use the app). By careful use of the Anchor and BorderStyle properties, you will achieve that.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Good advice of Mike. And I conclude you only have a problem if the taskbar isn't set to auto hide and maximising your form nevertheless makes use of the full display when the taskbar shouldn't be hidden. Because as far as I tested VFP plays by the rules.

Bye, Olaf.

 

Yes, this is the problem. Taskbar autohide is set to .F. , then too my form is overlapping taskbar.

I have set Titlebar = 0 and borderstyle = 0 for my main form
 
That's new info, what's your forms desktop and showwindow?

Experimenting a bit I see that happen if desktop=.T., not if desktop=.F. at the same time having ShowWindow=2.

The help on the Desktop property remarks you shouldn't mix these two things. So this unwanted behaviour might be related. If you have set ShowWindow=2, which you should, if you want it to become display size, then it's not confined in the _screen and will display on the desktop and not be clipped by _screen, that's enough.

Finally, I can reproduce this with this class:
Code:
o = CREATEOBJECT("myform")
o.show

DEFINE CLASS myform as Form
   Desktop = .T.
   Showwindow = 2
   WindowState = 2
   TitleBar=0
ENDDEFINE

If you test this, no worries to not get back to your desktop, you have Windows+M and Windows key alone will bring up the taskbar (that's not said to solve the problem, but to guide others testing this to get back into the VFP IDE and let that become activated).

Setting TitleBar=1 (default) or Desktop = .F. (default) stops this behavior. And I think it's even more about the title bar removal, because with Desktop = .F. the titlebar appears, too. I think this is related to a top-level form. Top-level forms also can't be modal, even when you set them modal. They also seem not be able to be without titlebar, unless Desktop=.T. puts the form into kiosk mode. It's a wild guess on that, but I think you can't get all you want if you want a borderless form without titlebar to appear maximised without hiding the taskbar, too. In the end no titlebar and no border and maximised top-level form all together with Desktop=.T. rather make your form look like a desktop itself, not just in the desktop.

Bye, Olaf.

PS: Notice, I didn't care for the BorderStyle, as maximised forms get borderless anyway, even if the form in a normal state still has borders.
 
Olaf ,
You caught the exact nerve. I had exactly the same setting
Desktop = .T.
Titlebar = 0
and so it was hiding my taskbar on setting WindowState = 2.

Thanks a lot for getting my problem solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top