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

Form title bars - deleting icon and closable button 3

Status
Not open for further replies.

Phil Thoms

Programmer
Oct 31, 2005
245
GB
How do you get rid of the Fox Icon in a form title bar and switching off the title bar doesn't seem to work properly also I want to delete the closable button in top right-hand corner. Thanks.
 
Form.Icon = Wahtever icon you want

Form.Titlebar = 0 works form me as for other forms. It does not work in conjunction with dockable forms, those with halfheight captions.

_screen.ControlBox = .f. removes close, min and max button. MinButton and MaxButton are other properties controlling just these buttons and you can set a form closable =.f. to disable the close button.

Also take a look into the help on the QueryUnload() event.

Bye, Olaf.
 
The question is, why do you want to remove the titlebar and standard buttons? This is windows and users are used to this interface of each form. Quitting a form of an application and quitting the application itself, if that is the close button of the main form, eg the _screen.

If you want to prevent closing of a form make it react to QueryUnload displaying a messagebox before returning .f. to prevent the form from closing. Also you can react to a shutdown by autosave and closing in another branch of the QueryUnload() event.

for example with something like that:
Code:
Local llClose
llClose = .f.

Do Case
   Case Thisform.ReleaseType = 0
       * variable released.
       * don't deny closing, programmer should know what he does
       llClose = .t.
   Case Thisform.ReleaseType = 1
       * user clicked close menu command or close box button
       If Not Thisform.savechanges()
          MessageBox("didn't yet save data")
          llClose = .f.
       EndIf
   Case Thisform.ReleaseType = 2
       * Windows is shutting down
       TableRevert(.t.)
       llClose = .t.
EndCase

Return llClose

savechanges() would then be another user defined method for (trying to) save data, which returns .t. for success and .f., if data wasn't saved for example.

This is not meant as THE only way to go, just a proposed way of handling the different types of form closing by releasing an object varible (programmatic), by the user or by the system.

Bye, Olaf.
 
Philthoms,

If you just want to remove or disable the Close button without getting rid of the title bar, then set the form's Closable property to .F.

This is not something that you would normally do, but there might be circumstances in which it's necessary. If you do, be sure to provide some other way of closing the form.

As far as the icon is concerned, as Olaf says, you set the form's Icon property to the name (and path) of an icon file (one with an ICO extension). The file should ideally include an icon that's 16 x 16 pixels.

Also, make sure that the ICO file is either included in your project, or is available at run time.

Hope this helps.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks for your help. I just wanted to remove the Fox Icon and as I have an Exit button on the form I wanted to remove closable button at top right also. Thanks.
 
Why not have both exit buttons. I think it's a good idea to have an exit button at the lower right corner, as there typically the form ends in respect of right-to-left oriented languages. But why remove the closebutton on the titlebar, it's the windows default element to close a form and it does not take away space, as long as you have a titlebar, which in itself is helpful to move a form.

Why move away from windows standards?

Mostly it's okay and even welcome to have many ways to do the same thing, via a button, a hotkey, a menu item, a toolbar button etc.

Many windows dialogs can either be closed both by the upper right X or an OK or Cancel button. Simply think of Messagebox(). Redundancy is good for a user interface.

Bye, Olaf.
 
Yes, I agree I will keep both ways of exiting. Going back to the Fox Icon - is there a way of NOT including it in the title bar ?
Thanks again
 
is there a way of NOT including it in the title bar

We've both already given you the answer to that:

Set the form's Icon property to the name of an ICO file. Whatever icon you specify will override the Fox icon.

If you don't want any icon at all - well, officially you can't do that. But the simple workaround is to create a completely invisible icon. Using any icon editor, create a 16x16 icon, and set all the pixels to invisible. Save it as, say, Invisible.ICO. Then set the form's Icon property to point to that file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
philthoms said:
Going back to the Fox Icon - is there a way of NOT including it in the title bar ?

As Mike says, asked and answered.

However, you really SHOULD leave the control menu (and the icon that "holds" it) in place. It actually serves a purpose and keeps your application "Windows-compatible". That control menu is what gives keyboard shortcuts to standard windows behaviors (zoom, move, close).
 
OVerall good advice: Don't act as if you're the only application running (unless you are in a very customeized environment like a internet cafe PC).

Be windows compatible and don't face users with a specialised UI unless you have a very good reason.

Bye, Olaf.
 
In regard to the Icon: Every single even the tiniest applications like calc.exe or notepad.exe have an icon there. Change it, but don't try to remove it. It's also the icon shown in the task bar, if an application is minimized.

If you really want your own looks you can paint in the titlebar, which is shown in the solution samples "Binding To Windows Message Events" where you need to choose "GDI+ Titlebar" in the Combobox and then Enable Events and then click on "display titlebar gradient".

You could also do something very specal like this:

But don't make your forms a maintainance nightmare for you stay with the standards and welcome to an OS running applications in parallel via preemptive multitasking, allowing user to choose what they want to do on their computer. We're not in a dosbox anymore here.

Bye, Olaf.
 
The only application on my system that does not have the control box is, coincidentally, the least well-behaved application: Apple's iTunes. <g> It's about as non-standard as a Windows application can get, and accordingly is sometimes difficult to manipulate.

But even lacking the control box, ALT-SPACEBAR fetches the control menu. Unfortunately there's no *mouse* way to get it. (Kind of ironic coming from such a mouse-centric platform as Mac.)
 
O god, iTunes. Yes, I hate it for not even letting me sort my music as I like. I have it to bye apps and sync my iPod, that's about it.

The only other good thing about it is, you can automate it via o=CreateObject("iTunes.Application").

Bye, Olaf.
 
It never even occurred to me to TRY automating it!

The weakest part of the experience of using an iPhone isn't AT&T. It's iTunes!
 
Thank you for all your advice and comments.
Very much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top