Mostrar / ocultar boton

Mostrar / ocultar boton

Postby goosfancito » Tue Jan 16, 2024 6:43 pm

Hola.

Estoy intentando hacer esto:
Code: Select all  Expand view
 IF ( HB_ArgV( 1 ) == "desarrollo" )
      ::oBtns[2]:show()
      ::oBtns[2]:baction := { || ::reset() }
   ELSE
      ::oBtns[2]:hide()
   ENDIF
 


pero cuando hb_argv(1) NO es igual a "desarrollo" no lo oculta.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Mostrar / ocultar boton

Postby Manuel Aranda » Wed Jan 17, 2024 8:21 am

Has probado añadiendo un refresh a oBtns[2]?
Un saludo,
Manuel

xH 1.2.3, FWH 23.07 32 bits, BC++ 7.4, xVerce CW 1.0, PellesC
User avatar
Manuel Aranda
 
Posts: 604
Joined: Wed Oct 19, 2005 8:20 pm
Location: España

Re: Mostrar / ocultar boton

Postby Antonio Linares » Wed Jan 17, 2024 8:47 am

Estimado Gustavo,

Asegúrate de que la ejecución del código pasa por ahí:
Code: Select all  Expand view
   IF ( HB_ArgV( 1 ) == "desarrollo" )
      ::oBtns[2]:show()
      ::oBtns[2]:baction := { || ::reset() }
   ELSE
      MsgInfo( "aqui" )
      ::oBtns[2]:hide()
   ENDIF
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Mostrar / ocultar boton

Postby karinha » Wed Jan 17, 2024 2:11 pm

Intenta:

Code: Select all  Expand view

      ::oBtns[2]:Disable()
      ::oBtns[2]:hide()
      ::oBtns[2]:Refresh()
 


Hay un ejemplo completo para testes?

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

Re: Mostrar / ocultar boton

Postby goosfancito » Wed Jan 17, 2024 2:54 pm

Antonio pasa por el lugar.
pero sigue si ocultarlo.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Mostrar / ocultar boton

Postby Antonio Linares » Wed Jan 17, 2024 3:57 pm

Por favor, muestra el código en donde creas ::oBtns[2]
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Mostrar / ocultar boton

Postby goosfancito » Wed Jan 17, 2024 5:34 pm

Code: Select all  Expand view
 DEFINE DIALOG ::oDlg resource "DLGMAIN" TITLE FWString( 7 ) + " Sucursal " + AllTrim( Str( 1 ) ) + " [" + IIf( HB_ArgV( 1 ) == "desarrollo", "DESARROLLO", "PRODUCCION" ) + " ]"

   ::setGets()
   ::setBtns()

   //----------( )----------

   ::oBtns[ 1 ]:bAction := { || ::agregarFactura() }

   IF ( HB_ArgV( 1 ) == "desarrollo" )
      ::oBtns[ 2 ]:show()
      ::oBtns[ 2 ]:baction := { || ::reset() }
   ELSE
      ::oBtns[2]:hide()
      ::obtns[2]:refresh()
      ? "pasa"
   ENDIF

   //----------( )----------

   DragAcceptFiles( ::oDlg:hWnd, .T. )

   ::oDlg:bDropFiles := { | nRow, nCol, uDropInfo |  IIf( ! ::lConsulta,  ::obtenerDatos( uDropInfo ), MsgStop( "No" ) ) }

   ACTIVATE DIALOG ::oDlg CENTERED ON INIT ( ;
                                             this:oDlg:setMenu( this:buildMenu() ), ;
                                             this:inicializar( ), ;
                                             this:limpiarGets() ;
                                           ) ;
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Mostrar / ocultar boton

Postby Antonio Linares » Thu Jan 18, 2024 4:58 am

Gustavo,

Necesitamos ver el código de ::setBtns()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Mostrar / ocultar boton

Postby goosfancito » Thu Jan 18, 2024 5:44 am

Code: Select all  Expand view
METHOD setBtns() CLASS TImportarXML

   REDEFINE BUTTON ::oBtns[ 1 ] ID 400 OF ::oDlg
   REDEFINE BUTTON ::oBtns[ 2 ] ID 410 OF ::oDlg

   ::oBtns[ 1 ]:disable()

   RETURN( NIL )


Code: Select all  Expand view
DLGMAIN DIALOGEX DISCARDABLE 6, 18, 799, 362
STYLE DS_SHELLFONT|WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Esportazione di file XML"
FONT 8, "Tahoma", 0, 0, 1
{
  CONTROL "500", 500, "Static", SS_CENTER|WS_GROUP, 24, 37, 84, 41
  CONTROL "501", 501, "Button", BS_GROUPBOX, 123, 12, 273, 81
  CONTROL "Cliente:", 502, "Static", SS_RIGHT|WS_GROUP, 131, 34, 54, 8
  CONTROL "Edit", 200, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 190, 32, 190, 12
  CONTROL "Indirizzo:", 503, "Static", SS_RIGHT|WS_GROUP, 131, 51, 54, 8
  CONTROL "Edit", 202, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 190, 50, 190, 12
  CONTROL "CAP:", 504, "Static", SS_RIGHT|WS_GROUP, 131, 70, 54, 8
  CONTROL "Edit", 204, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 190, 68, 31, 12
  CONTROL "Comuna:", 505, "Static", SS_RIGHT|WS_GROUP, 228, 70, 31, 8
  CONTROL "Edit", 206, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 264, 68, 63, 12
  CONTROL "Prov.:", 4001, "Static", SS_RIGHT|WS_GROUP, 330, 70, 25, 8
  CONTROL "Edit", 208, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 359, 68, 21, 12
  CONTROL "506", 506, "Button", BS_GROUPBOX, 17, 100, 175, 173
  CONTROL "Id fattura:", 4003, "Static", SS_RIGHT|WS_GROUP, 37, 123, 57, 8
  CONTROL "Edit", 210, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 121, 79, 12
  CONTROL "Codice fiscale:", 4006, "Static", SS_RIGHT|WS_GROUP, 37, 141, 57, 8
  CONTROL "Edit", 212, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 139, 79, 12
  CONTROL "Imponibile:", 507, "Static", SS_RIGHT|WS_GROUP, 37, 165, 57, 8
  CONTROL "Edit", 214, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 163, 50, 12
  CONTROL "Totale IVA:", 508, "Static", SS_RIGHT|WS_GROUP, 37, 183, 57, 8
  CONTROL "Edit", 216, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 181, 50, 12
  CONTROL "", 509, "Static", WS_GROUP, 157, 183, 26, 8
  CONTROL "Totale fattura:", 510, "Static", SS_RIGHT|WS_GROUP, 37, 207, 57, 8
  CONTROL "Edit", 218, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 205, 50, 12
  CONTROL "Sconto:", 511, "Static", SS_RIGHT|WS_GROUP, 37, 225, 57, 8
  CONTROL "Edit", 220, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 223, 50, 12
  CONTROL "512", 512, "Button", BS_GROUPBOX, 17, 278, 175, 61
  CONTROL "Data:", 513, "Static", SS_RIGHT|WS_GROUP, 37, 298, 43, 8
  CONTROL "Edit", 222, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 86, 296, 90, 12
  CONTROL "Importo:", 514, "Static", SS_RIGHT|WS_GROUP, 37, 316, 43, 8
  CONTROL "Edit", 224, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 86, 314, 90, 12
  CONTROL "Salvare", 400, "Button", WS_TABSTOP, 277, 315, 50, 14
  CONTROL "A carico del cliente:", 4002, "Static", SS_RIGHT|WS_GROUP, 23, 249, 71, 8
  CONTROL "Edit", 221, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 99, 247, 50, 12
  CONTROL "515", 515, "Button", BS_GROUPBOX, 205, 100, 417, 108
  CONTROL "Edit", 226, "Edit", ES_MULTILINE|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_READONLY|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 214, 114, 173, 86
  CONTROL "516", 516, "Button", BS_GROUPBOX, 205, 212, 191, 88
  CONTROL "", 228, "ListBox", LBS_SORT|LBS_NOTIFY|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 214, 220, 173, 78
  CONTROL "RESET", 410, "Button", WS_TABSTOP, 277, 332, 50, 14       <-------------------------------//--------------------- // ----------------------------
  CONTROL "Check-box", 4004, "Button", BS_AUTOCHECKBOX|WS_TABSTOP, 423, 121, 48, 10
}
 
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Mostrar / ocultar boton

Postby Antonio Linares » Thu Jan 18, 2024 6:33 am

Gustavo,

un control de un diálogo no tiene un handle válido de Windows hasta que no se activa el diálogo, por eso no te funciona

Puedes hacerlo asi:

REDEFINE BUTTON ::oBtns[ 2 ] ID 410 OF ::oDlg WHEN ! HB_ArgV( 1 ) == "desarrollo"
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Mostrar / ocultar boton

Postby goosfancito » Thu Jan 18, 2024 8:01 am

Perfecto,
Ahora lo entendi, modifique mi codigo y si funciona.
Code: Select all  Expand view
  ACTIVATE DIALOG ::oDlg CENTERED ON INIT ( ;
                                             this:oDlg:setMenu( this:buildMenu() ), ;
                                             this:inicializar( ), ;
                                             this:limpiarGets(), ;
                                             IIf(HB_ArgV( 1 ) == "desarrollo", this:obtns[2]:show(), this:obtns[2]:hide());
                                           ) ;
 
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Mostrar / ocultar boton

Postby Antonio Linares » Thu Jan 18, 2024 8:10 am

Probaste con el WHEN ?

ambas formas deben funcionar correctamente :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42098
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Mostrar / ocultar boton

Postby goosfancito » Thu Jan 18, 2024 11:28 am

si, solo que yo necesito que se oculte si no es "desarrollo" pero si funciono
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests