FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Antonio:
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
To Antonio:
Posted: Mon Apr 01, 2013 05: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 (fw): Select all Collapse
   @ 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 ?
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: To Antonio:
Posted: Mon Apr 01, 2013 09:58 AM
Gustavo,

Este ejemplo puede darte una idea de como hacerlo:

Code (fw): Select all Collapse
#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
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: To Antonio:
Posted: 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.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: To Antonio:
Posted: Mon Apr 01, 2013 02: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: To Antonio:
Posted: Mon Apr 01, 2013 04:00 PM
Hunter, maybe you'd want to do this way:

Code (fw): Select all Collapse
 @ 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: To Antonio:
Posted: Mon Apr 01, 2013 05:10 PM

Francisco,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: To Antonio:
Posted: Mon Apr 01, 2013 05:26 PM

Antonio,
It is a pleasure to collaborate.
Best regards.

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: To Antonio:
Posted: Mon Apr 01, 2013 07: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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: To Antonio:
Posted: Mon Apr 01, 2013 08:57 PM
Gustavo,

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

Code (fw): Select all Collapse
@ 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion