FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Inhabilitar boton cerrar ventada
Posts: 396
Joined: Tue Mar 18, 2008 09:41 PM
Inhabilitar boton cerrar ventada
Posted: Fri Aug 22, 2008 02:04 PM

Hola a todos,

Quisiera saber si se puede hacer que el botΓ³n cerrar ventana, aparezca inhabilitado.

Un saludo.
Javier. :wink:

Javier,

FWH 8.04 2008
Posts: 344
Joined: Tue Oct 11, 2005 11:33 AM
Inhabilitar boton cerrar ventada
Posted: Fri Aug 22, 2008 02:12 PM
OlΓ‘,

Tente isto:

// Our first DialogBox sample

#include "FiveWin.ch"

function Main()

   local oDlg, oIco, cTest := "Hello world!   "

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

   DEFINE DIALOG oDlg TITLE "I am a DialogBox" COLOR "W+/B" ;
      ICON oIco

   oDlg:lHelpIcon := .F.

   @ 1, 3 GET cTest

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

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

   ACTIVATE DIALOG oDlg CENTERED ;
    ON INIT DisableB( oDlg ) ;
      VALID MsgYesNo( "Do you want to end ?" )

return nil

procedure AppSys // XBase++ requirement

return

#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED   0x00000002L
#define MF_REMOVE  0x00001000L

*****************
function DisableB( oWnd )
*****************

return RemoveMenu( GetSystemMenu( oWnd:hWnd, .f. ), 1, MF_BYPOSITION )


AbraΓ§os,

Rossine.
Obrigado, Regards, Saludos



Rossine.



Harbour and Harbour++
Posts: 396
Joined: Tue Mar 18, 2008 09:41 PM
Inhabilitar boton cerrar ventada
Posted: Fri Aug 22, 2008 08:16 PM
Gracias Rossine, pero no funciona.

Ademas, no trabajo con dialogos, sino con una ventana principal.

DEFINE WINDOW oWnd 

ACTIVATE WINDOW oWnd ON INIT disable( oWnd )

STATIC function disabled( oWnd )

return RemoveMenu( GetSystemMenu( oWnd:hWnd, .f. ), 1, 1024 )


:-)
Javier,

FWH 8.04 2008
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Inhabilitar boton cerrar ventada
Posted: Sun Aug 24, 2008 09:24 AM
jfafive wrote:Ademas, no trabajo con dialogos, sino con una ventana principal.
Hola Javier:

Prueba Γ©sto:
#include "FiveWin.ch"

#define MF_BYPOSITION 0x0400L
#define MF_BYCOMMAND  0x0000L
#define MF_GRAYED     0x0001L
#define SC_CLOSE      0xF060L

Function Main()

   Local oWnd

   DEFINE WINDOW oWnd TITLE "I am a Window" NOMINIMIZE NOZOOM

   NoCloseButton( oWnd )

   @ 43, 16 BUTTON "&Salir" SIZE 80, 24 PIXEL ACTION oWnd:End()

   ACTIVATE WINDOW oWnd ;
      VALID MsgYesNo( "Salir" )

Return Nil

Static Function NoCloseButton( oWnd )

   // puedes usar cualquiera de estas 2 opciones
   EnableMenuItem( GetSystemMenu( oWnd:hWnd, .F. ), SC_CLOSE, nOr( MF_BYCOMMAND, MF_GRAYED ) )
   //ModifyMenu( GetSystemMenu( oWnd:hWnd, .F. ), SC_CLOSE, nOr( MF_BYCOMMAND, MF_GRAYED), -10, "Close")
   DrawMenuBar( oWnd:hWnd ) // actualiza el menu

Return Nil

Saludos.

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Inhabilitar boton cerrar ventada
Posted: Sun Aug 24, 2008 02:38 PM
Prueba lo siguiente:
 @ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg:End();
                 WHEN(Tu condiciΓ³n) // O si no pone directamente WHEN(.f.)


Espero te sirva.
Saludos.
Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 396
Joined: Tue Mar 18, 2008 09:41 PM
Inhabilitar boton cerrar ventada
Posted: Mon Aug 25, 2008 07:49 AM
Hola Manuel,

Tengo problemas con el codigo que me enviastes. Al parecer, no le gusta la 'L' en las definiciones #define...

Pues al compilar me da el siguiente error:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ FiveWin for Harbour 8.04 - Apr. 2008            Harbour development power  β”‚β–„
β”‚ (c) FiveTech, 1993-2008    for Microsoft Windows 95/98/NT/2000/ME/XP/Vista β”‚β–ˆ
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β–ˆ
Β  β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€β–€
Compiling...
Harbour devel build 1.1-1 Intl.
Copyright (c) 1999-2007, http://www.harbour-project.org/
Compiling 'prueba.prg' and generating preprocessed output to 'prueba.ppo'...
1 error

No code generated
prueba.prg(26) Error E0030  Syntax error: "syntax error at 'L'"
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
prueba.c:
Borland Resource Compiler  Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation.  All rights reserved.
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
* Application successfully built


La lΓ­nea 26, hace referencia a la funciΓ³n que usa el identificador, es decir,

EnableMenuItem( GetSystemMenu( oWnd:hWnd, .F. ),;
 SC_CLOSE, nOr( MF_BYCOMMAND, MF_GRAYED ) )
Javier,

FWH 8.04 2008
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Inhabilitar boton cerrar ventada
Posted: Mon Aug 25, 2008 08:47 AM

Javier,

Prueba a quitar las L del final de esos defines

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 396
Joined: Tue Mar 18, 2008 09:41 PM
Inhabilitar boton cerrar ventada
Posted: Mon Aug 25, 2008 10:40 AM

Ok,

FuncionΓ³ fin las 'L'

Gracias Manuel,
Gracias Antonio,

:D

Javier,

FWH 8.04 2008

Continue the discussion