Quitar boton [X] de un dialogo

Quitar boton [X] de un dialogo

Postby Compuin » Mon Mar 15, 2021 2:15 pm

Saludos foro,

Como puedo ocultar el Boton [X] en un dialogo?

Gracias de antemano
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
Compuin
 
Posts: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: Quitar boton [X] de un dialogo

Postby José Vicente Beltrán » Mon Mar 15, 2021 2:51 pm

Hola,
eso puedes hacerlo desde el editor de recursos, 'system menu -> No'

saludos :shock:
User avatar
José Vicente Beltrán
 
Posts: 282
Joined: Mon Oct 10, 2005 8:55 am
Location: Algeciras, España

Re: Quitar boton [X] de un dialogo

Postby Compuin » Mon Mar 15, 2021 2:52 pm

Hola Jose Vicente,

Gracias por tu respuesta.

En mi caso no uso recursos para los Dialogos.

Como lo resuelvo?
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
Compuin
 
Posts: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: Quitar boton [X] de un dialogo

Postby carlos vargas » Mon Mar 15, 2021 4:38 pm

Code: Select all  Expand view  RUN


PROCEDURE DisableX( oDlg, lDisable )
   LOCAL hMenu  := 0
   LOCAL nCount := 0

   DEFAULT lDisable := TRUE

   IF lDisable
      hMenu  := GetSystemMenu( oDlg:hWnd, FALSE )
      nCount := GetMItemCount( hMenu )
      IF oDlg:ClassName() = "TDIALOG"
         RemoveMenu( hMenu, 1, nOR( 1024, 2) )
      ELSE
         RemoveMenu( hMenu, nCount - 1, nOR( 1024, 2 ) )
         RemoveMenu( hMenu, nCount - 2, nOR( 1024, 2 ) )
      ENDIF
      DrawMenuBar( oDlg:hWnd )
   ELSE
      GetSystemMenu( oDlg:hWnd, TRUE )
      DrawMenuBar( oDlg:hWnd )
   ENDIF

RETURN

 
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Quitar boton [X] de un dialogo

Postby karinha » Mon Mar 15, 2021 4:47 pm

Teste:

Code: Select all  Expand view  RUN

   STYLE nOr( DS_SYSMODAL, DS_MODALFRAME )

   WS_POPUP
   WS_CAPTION
   WS_SYSMENU
   WS_3DLOOK
   WS_VISIBLE
   WS_THICKFRAME
   WS_VISIBLE
   WS_OVERLAPPEDWINDOW )
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7844
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Quitar boton [X] de un dialogo

Postby FranciscoA » Mon Mar 15, 2021 5:08 pm

Compuin wrote:Hola Jose Vicente,

Gracias por tu respuesta.

En mi caso no uso recursos para los Dialogos.

Como lo resuelvo?


Hola.
Intenta asi:
Code: Select all  Expand view  RUN
DEFINE DIALOG oDlg SIZE nWd,nHt PIXEL TITLE "LIGAS PARA LICORES" ;
       STYLE (WS_POPUP|WS_VISIBLE)
 


ó

Code: Select all  Expand view  RUN
DEFINE DIALOG oDlg SIZE nWd,nHt PIXEL TITLE "LIGAS PARA LICORES" ;
       STYLE (WS_POPUP|WS_VISIBLE|WS_CAPTION)
 
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Quitar boton [X] de un dialogo

Postby Compuin » Mon Mar 15, 2021 5:46 pm

karinha wrote:Teste:

Code: Select all  Expand view  RUN

   STYLE nOr( DS_SYSMODAL, DS_MODALFRAME )

   WS_POPUP
   WS_CAPTION
   WS_SYSMENU
   WS_3DLOOK
   WS_VISIBLE
   WS_THICKFRAME
   WS_VISIBLE
   WS_OVERLAPPEDWINDOW )
 


Muchas gracias, ya funciona como lo recomendastes
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
Compuin
 
Posts: 1214
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: Quitar boton [X] de un dialogo

Postby karinha » Tue Mar 16, 2021 6:58 pm

Gracias Master Carlos Vargas,

Code: Select all  Expand view  RUN

// \SAMPLES\DISABLEX.PRG - Example, By: Carlos Vargas. In xHarbour, perfect.

#Include "FiveWin.ch"

#Define TRUE  .T.
#Define FALSE .F.

FUNCTION Main()

   LOCAL lDisable AS LOGICAL
   LOCAL oDlg AS OBJECT
   LOCAL oIco AS OBJECT
   LOCAL cTest := "Hello world!   "

   lDisable := TRUE

   DEFINE ICON oIco FILE "..\icons\fivewin.ico"

   DEFINE DIALOG oDlg TITLE "DialogBox and DisableX" COLOR "W+/B" ;
      ICON oIco

   @ 1, 3 GET cTest DIALOG oDlg

   @ 3, 5 BUTTON "&Ok" DIALOG oDlg SIZE 40, 12 ;
      ACTION MsgInfo( "Any action here!" ) DEFAULT

   @ 3, 16 BUTTON "&Cancel" DIALOG oDlg SIZE 40, 12 ACTION( oDlg:End() )

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT( DisableX( oDlg, lDisable ) )

RETURN NIL

PROCEDURE DisableX( oDlg, lDisable )

   LOCAL hMenu  := 0
   LOCAL nCount := 0

   DEFAULT lDisable := TRUE

   IF lDisable

      hMenu  := GetSystemMenu( oDlg:hWnd, FALSE )
      nCount := GetMItemCount( hMenu )

      IF oDlg:ClassName() = "TDIALOG"

         RemoveMenu( hMenu, 1, nOR( 1024, 2) )

      ELSE

         RemoveMenu( hMenu, nCount - 1, nOR( 1024, 2 ) )

         RemoveMenu( hMenu, nCount - 2, nOR( 1024, 2 ) )

      ENDIF

      DrawMenuBar( oDlg:hWnd )

   ELSE

      GetSystemMenu( oDlg:hWnd, TRUE )

      DrawMenuBar( oDlg:hWnd )

   ENDIF

RETURN

// FIN - 16/03/2021 - Covid-19 - kapiabafwh@gmail.com
 


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7844
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests