Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Form title bar icon

538 views
Skip to first unread message

Sithu

unread,
Oct 5, 2009, 11:09:03 PM10/5/09
to
Does anybody know how to hide icon in the title bar of the form ?
Is there any property of this ?

Jürgen Wondzinski

unread,
Oct 6, 2009, 3:41:14 AM10/6/09
to
Hi Sithu,

you cannot "hide" the icon, as it is attached to the eventhandler for the
window-menu (do a rightclick on it or press Alt-Space for a TopWindow and
Ctrl-Space for ChildWindows). This eventhandler is officially called the
"Controlbox", which you can switch off with the similar named property of a
form. But then also all related funtionality is gone (no movement, no zoom,
minimize etc). BTW: The Min/Max/Close icons on the right of the window
titlebar are only additional shortcuts to the window-controlbox, therefor
those will also not work if you remove the controlbox.

If you need the functionality, but don't want to see an icon, you could
maybe fake it with some sort of "empty" icon ?

If you want to create some sort of "splashscreen", there's also a Titlebar
property, which removes the whole top area of a form.
--

wOOdy
Visual FoxPro Evangelist
Microsoft "Most Valuable Professional" 1996 to 2009

"*��)
�.���.�*��) �.�*�)
(�.��. (�.�` *
..�`.Visual FoxPro: It's magic !
(�.�``��*

Sithu

unread,
Oct 7, 2009, 12:52:16 AM10/7/09
to
Thank you, Wondzinski.

I tried the sort of "empty" icon.
But, VFP accepts ony minimum icon dimension 16x16.
It seems no icon. Caption is away from the left most side of the title
bar because of empty icon.
This is not what I want.
I tried the icon dimension 1x1, but VFP failed to accept it.

The only way is to hide the whole title bar and make custom title bar.
Isn't it ?

With regards,
Sithu

Jürgen Wondzinski

unread,
Oct 8, 2009, 10:17:32 AM10/8/09
to

Hi Sithu,

> But, VFP accepts ony minimum icon dimension 16x16.

Ofcourse. Icons are predefined and have to have special sizes, yoou can't
just make your own sizes. Normally the minimum size is 16x16, and starting
with Win95, additional bigger images can optionally get added to the same
icon file.

Thus for starters you could create an *.ico file with 16x16, which is just
filled with the color of your titlebar.

>> Thank you, Wondzinski.
{giggle} please call me "woody" or "J�rgen"; the "Wondzinski" is the
Lastname

Sithu

unread,
Oct 9, 2009, 3:27:15 AM10/9/09
to
I now created my own message box.
So, it can show my own ico and consistent appearance for the whole
application.

amar...@gmail.com

unread,
Oct 6, 2013, 4:59:21 AM10/6/13
to
Shitu,
use WM_SETICON winapi message *AFTER* set any titlebar properties (Caption, MinButton, ControlBox, Closable, etc), or Bind to Show event.
Look at RemoveIcon method in this code:

[CODE]
LOCAL oDlg AS xmsgbox
m.oDlg = CREATEOBJECT('xmsgbox')
m.oDlg.Show
? m.oDlg.GetResult()

*--
* http://msdn.microsoft.com/en-us/library/windows/desktop/ms632643.aspx
*--
#ifndef WM_SETICON
#define WM_SETICON 0x0080
#endif
* wParam:
#ifndef ICON_SMALL
#define ICON_BIG 1 && large icon for the window (Alt+Tab)
#define ICON_SMALL 0 && small icon for the window caption
#define ICON_SMALL2 2 && small icon provided by the application
#endif
*--

DEFINE CLASS xmsgbox AS Form
AllowOutput = .F.
AlwaysOnTop = .T.
AutoCenter = .T.
BorderStyle = 2 && fixed dialog
Caption = _Screen.Caption
Desktop = .T.
MinButton = .F.
MaxButton = .F.
ShowWindow = 1 && In Top-Level Form
ShowInTaskbar = .F.
WindowType = 1
Height = 160
Width = 280
ColorSource = 5 && Window COlors
FontName = 'Segoe UI'

nResult = 0
ADD OBJECT shape1 AS Shape WITH BorderStyle = 0, Left = -2
ADD OBJECT cmgBtnBar AS cmgButtons

PROCEDURE Show
IF VAL(OS(3)) < 6
This.FontName = 'Tahoma'
ENDIF
WITH This.cmgBtnBar
This.Closable = .CanCancel() && if you have a .Cancel commandbutton
.Reset
ENDWITH
WITH This.Shape1 AS Shape
.Top = This.cmgBtnBar.Top - 5
.Width = This.Width + 4
.Height = This.Height - .Top + 2
.Anchor = 15
.ZOrder(1)
ENDWITH
This.RemoveIcon
ENDPROC

PROCEDURE RemoveIcon
DECLARE Long SendMessage IN WIN32API ;
Integer hWnd, Integer uMsg, Integer wParam, Long lParam
*--
SendMessage(This.HWnd, WM_SETICON, ICON_SMALL, 0)
SendMessage(This.HWnd, WM_SETICON, ICON_SMALL2, 0)
ENDPROC

PROCEDURE cmgBtnBar.OnButton(nID)
Thisform.nResult = m.nID
Thisform.Hide
ENDPROC

FUNCTION GetResult()
RETURN This.nResult
ENDFUNC
ENDDEFINE

DEFINE CLASS cmgButtons AS CommandGroup
BorderStyle = 0
BackStyle = 0
Value = 0
nExtraMargin = 4

PROCEDURE Init
This.ButtonCount = 2
WITH This.Buttons(1) AS CommandButton
.Name = 'cmdOk'
.Caption = 'OK'
.Default = .T.
.AddProperty('nID', 1) &&IDOK
ENDWITH
WITH This.Buttons(2)
.Caption = 'Cancel'
.Cancel = .T.
.Left = This.cmdOK.Left + This.cmdOK.Width + 8
.Top = This.cmdOK.Top
.AddProperty('nID', 2) &&IDCANCEL
ENDWITH
ENDPROC

PROCEDURE Reset
WITH This
.SetAll('FontName', Thisform.FontName)
.AutoSize = .T.
.Left = Thisform.Width - .Width - .nExtraMargin
.Top = Thisform.Height - .Height - .nExtraMargin
.Anchor = 12 && keep on lower right corner of form
ENDWITH
ENDPROC

PROCEDURE InteractiveChange
IF This.Value >= 1 && Skip CTRL+0
RAISEEVENT(This, 'OnButton', This.Buttons(This.Value).nID)
ENDIF
ENDPROC

PROCEDURE OnButton(nID)
*
ENDPROC

FUNCTION CanCancel()
LOCAL oBtn
FOR EACH oBtn IN This.Buttons
IF m.oBtn.Cancel
RETURN .T.
ENDIF
NEXT
RETURN .F.
ENDFUNC
ENDDEFINE

[/CODE]

Sorry for my "spanglish" :-)
---
Alberto Martínez (amarcruz at yahoo+com)
0 new messages