How do I remove the X close on the top of a dialog box?

How do I remove the X close on the top of a dialog box?

Postby Mike Buckler » Mon Nov 17, 2008 7:27 pm

I would like to remove the X close button on the top right corner of a dialog box.
Any help would be greatly appreciated.
Thanks In Advance Mike.
Mike Buckler
 
Posts: 67
Joined: Thu Jan 05, 2006 10:35 pm
Location: Canada

Postby jcaro » Mon Nov 17, 2008 7:58 pm

Mike:

With your resource editor ( I used PellesC )

Change the your dialog properties of system menu to NOT

That is all.
Juan
==> Pasando a FWH16.04 + Harbour32 + BCC70 + PellesC
=> Abandonando FWH 13.7 + xHarbour + BCC582
http://www.mitaller.cl
jcaro
 
Posts: 270
Joined: Fri Nov 11, 2005 7:39 pm

Postby Daniel Garcia-Gil » Mon Nov 17, 2008 8:08 pm

DEFINE dialog oDlg STYLE WS_CAPTION
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Postby fafi » Mon Nov 17, 2008 11:55 pm

DEFINE DIALOG oDlg STYLE nOR( WS_POPUP, WS_VISIBLE )

blank DIALOG without border
User avatar
fafi
 
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Postby Mike Buckler » Tue Nov 18, 2008 12:29 am

Is there a way to keep a menu icon and not have the X close window in the top right corner?
Thanks Mike.
Mike Buckler
 
Posts: 67
Joined: Thu Jan 05, 2006 10:35 pm
Location: Canada

Postby RAMESHBABU » Tue Nov 18, 2008 11:30 am

Hello Mike,

This is the working code :

Code: Select all  Expand view
#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED   2   
*******************************************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog  ***
*******************************************************************************

FUNCTION DisableX(oWin, lDisable)

LOCAL hMenu  := 0
LOCAL nCount := 0
   
IF lDisable
   hMenu  = GetSystemMenu(oWin:hWnd, .F.)
   nCount = GetMItemCount(hMenu)
   RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
   RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
   DrawMenuBar( oWin:hWnd )
ELSE
   GetSystemMenu( oWin:hWnd, .T. )
   DrawMenuBar( oWin:hWnd )
ENDIF

RETURN nil


Reagrds,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Mike Buckler » Tue Nov 18, 2008 4:01 pm

How does the dialog style have to be set to have diasblex work, The dialog I am testing on is from pelles c resource and I have tried with system true and false.
Thanks Mike
Mike Buckler
 
Posts: 67
Joined: Thu Jan 05, 2006 10:35 pm
Location: Canada

Postby RAMESHBABU » Tue Nov 18, 2008 4:39 pm

Hello Mike,

This code works with the dialogs created from Borland Resource Workshop perfectly. I am very sorry, I dont know anything about pelles c resources.

I wonder out of my academic interest, either Borland or Pelles they are expected to normally respect the windows standards and accordingly they design such resource management tools. I dont' know why PELLES C is different from Borland! or vice-versa.

Regards,

- Ramesh
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Mike Buckler » Tue Nov 18, 2008 5:59 pm

Thanks Ramesh
MIke
Mike Buckler
 
Posts: 67
Joined: Thu Jan 05, 2006 10:35 pm
Location: Canada

Hide X ( exit ) in Dialog

Postby ukoenig » Sat Nov 22, 2008 7:34 pm

Hello Ramesh,

I tested Your solution to hide the X ( exit ) in dialog.
It works fine with MDI. If I use it in a stand-alone Dialog,
I cannot move the dialog anymore.
Do you know a solution, to keep the dialog moving ?

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Horizon » Sun Nov 23, 2008 12:32 pm

Hi Uwe,

You can use

Code: Select all  Expand view
STYLE nOr( WS_OVERLAPPEDWINDOW )
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Disable X Exit-Button

Postby ukoenig » Mon Nov 24, 2008 12:13 pm

Hello,

The useful function from RAMESHBABU, i use in my MDI-app's to control
the button-status ( enable or disable ) of the office-bar and it works fine.
But if I use a MODAL Dialog, I cannot move the dialog.
Is it possible, to get it working with MODAL dialog as well ?

The solution from HORIZON I tested but didn't help

Code: Select all  Expand view
#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED   2
...
...
DEFINE DIALOG oDlg RESOURCE "Tools" OF oWnd TRANSPARENT ;
TITLE  "Selection" FONT oProgFont
...
...
...  It works !!

ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT ( oDlg:Move( 30 , 50, oDlg:nWidth, oDlg:nHeight, .f. ), ;
DisableX(oDlg, .T.)  ) )

RETURN NIL
   
*******************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog  ***
*******************************************************

FUNCTION DisableX(oWin, lDisable)

LOCAL hMenu  := 0
LOCAL nCount := 0
   
IF lDisable
   hMenu  = GetSystemMenu(oWin:hWnd, .F.)
   nCount = GetMItemCount(hMenu)
   RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
   RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
   DrawMenuBar( oWin:hWnd )
ELSE
   GetSystemMenu( oWin:hWnd, .T. )
   DrawMenuBar( oWin:hWnd )
ENDIF

RETURN nil

Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby RAMESHBABU » Mon Nov 24, 2008 2:16 pm

Hello Mr.Uwe

This is what you are looking for:

Code: Select all  Expand view

*******************************************************************************
*** FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog  ***
*******************************************************************************

FUNCTION DisableX(oWin, lDisable)

LOCAL hMenu  := 0
LOCAL nCount := 0

IF lDisable
   hMenu  = GetSystemMenu(oWin:hWnd, .F.)
   nCount = GetMItemCount(hMenu)
   IF oWin:ClassName() = "TDIALOG"
      RemoveMenu(hMenu, 1, nOR( MF_BYPOSITION, MF_DISABLED) )
   ELSE
      RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
      RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
   ENDIF    
   DrawMenuBar( oWin:hWnd )
ELSE
   GetSystemMenu( oWin:hWnd, .T. )
   DrawMenuBar( oWin:hWnd )
ENDIF

RETURN nil


Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Disable X ( Exit ) in Dialog.

Postby ukoenig » Mon Nov 24, 2008 2:59 pm

Hello RAMESHBABU,

thank You very much for Your help.
It works PERFECT now.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby RAMESHBABU » Mon Nov 24, 2008 3:16 pm

Hello Mr.Uwe,

You are most welcome.

Regards,

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 100 guests