To Antonio:

To Antonio:

Postby HunterEC » Mon Apr 01, 2013 5:21 am

Antonio:

I've been trying to hide a button when entering a GET (via the WHEN clause) and displaying / enabling it at GET exit (via the VALID clause). The first part works OK, the second (VALID clause) does not work at all. The button stays hidden.
Code: Select all  Expand view
  @ 025,045 GET oGets[01] VAR adRefDate[1]    OF oDlg SIZE 40,10 PIXEL ;
             PICTURE "D" CENTER WHEN (oButtons[2]:hide(), oButtons[2]:disable(), .T.) ;
             VALID (oButtons[2]:show(), oButtons[2]:enable(), .T.)


Any ideas ?
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby Antonio Linares » Mon Apr 01, 2013 9:58 am

Gustavo,

Este ejemplo puede darte una idea de como hacerlo:

Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oGet, cTest := Space( 20 ), oBtn

   DEFINE DIALOG oDlg

   @ 2, 5 GET oGet VAR cTest OF oDlg ;
      WHEN ( oBtn:Hide(), oGet:bWhen := nil, .T. ) ;
      VALID ( oBtn:Show(), .T. )

   @ 3, 6 BUTTON oBtn PROMPT "Ok" OF oDlg

   @ 3, 14 BUTTON "Cancel" OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

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

Re: To Antonio:

Postby HunterEC » Mon Apr 01, 2013 11:34 am

Antonio:

On your example the button appears after exiting the get the first time. If I Back-Tab to the GET the button does not disappear anymore. FiveWin 10.6 Thank you for your help.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby James Bott » Mon Apr 01, 2013 2:20 pm

Hunter,

From a design perspective I don't think disappearing buttons are good idea. This is confusing to the user and non-standard. Disabling buttons are standard and this is what I would suggest.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Antonio:

Postby FranciscoA » Mon Apr 01, 2013 4:00 pm

Hunter, maybe you'd want to do this way:

Code: Select all  Expand view
@ 025,045 GET oGets[01] VAR adRefDate[1]    OF oDlg SIZE 40,10 PIXEL  PICTURE "D" CENTER
 oGets[01]:bGotFocus:={|| oBt1:Hide() }
 oGets[01]:bLostFocus:={|| oBt1:Show()
}

Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

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

Re: To Antonio:

Postby Antonio Linares » Mon Apr 01, 2013 5:10 pm

Francisco,

yes, very good. I missed that one, thanks :-)
regards, saludos

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

Re: To Antonio:

Postby FranciscoA » Mon Apr 01, 2013 5:26 pm

Antonio,
It is a pleasure to collaborate.
Best regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

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

Re: To Antonio:

Postby HunterEC » Mon Apr 01, 2013 7:33 pm

Francisco, Antonio, James:

Thank you all guys, worked "by the book", as intended.

James:

Thank you for your design tip. I'll take it for current and future developments.


Gustavo
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: To Antonio:

Postby James Bott » Mon Apr 01, 2013 8:57 pm

Gustavo,

I think these changes to the code will provide disable/enable capability.

Code: Select all  Expand view
@ 025,045 GET oGets[01] VAR adRefDate[1]    OF oDlg SIZE 40,10 PIXEL  PICTURE "D" CENTER
 oGets[01]:bGotFocus:={|| oBt1:disable() }
 oGets[01]:bLostFocus:={|| oBt1:enable()


James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

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