BTNGET vs GET..ACTION..BITMAP

BTNGET vs GET..ACTION..BITMAP

Postby Ugo » Mon Mar 02, 2009 6:17 pm

Antonio Linares wrote:FWH supports this syntax now:

@ ..., .. GET ... ACTION ... BITMAP ...

There is no need to keep using TBtnGet.

Dear Antonio,

I use the redefine, work, but not well, the button position is not on the right!
Image

and next, how to support RESOURCE clause?

In the image the second is btnget :-(

Many thanks for your reponse.
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: BTNGET vs GET..ACTION..BITMAP

Postby dutch » Tue Mar 03, 2009 8:07 am

Dear Ugo,

I think Antonio will include RESIZE16 clause fixed for GET..ACTION. If not now you can fix as following. I've changed all BTNGET to original GET..ACTION and working without problem

Code: Select all  Expand view

METHOD CreateButton() CLASS TGet
   local oThis := Self
   if ValType( ::bAction ) == "B" .and. Upper( ::ClassName() ) == "TGET"
      if Empty( ::cBmpName )
         @ 0, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
         ACTION ( Eval( oThis:bAction, oThis ) ) ;   // , oThis:LostFocus() ) ;  
         SIZE ::nHeight - 4, ::nHeight - 4 PIXEL
         if Empty( ::oBtn:hBitmap )
            ::oBtn:SetText( "..." )
         endif      
      else  
         @ 0, ::nWidth - ::nHeight BUTTONBMP ::oBtn OF Self ;
         ACTION ( Eval( oThis:bAction, oThis ) ) ;  //  oThis:SetFocus() ) ;
         SIZE ::nHeight - 4, ::nHeight - 4 PIXEL BITMAP ::cBmpName
      endif
//  add this 3 lines.
      if Upper( ::oWnd:ClassName() ) == "TDIALOG" .and. ::oWnd:lResize16
         ::oBtn:nLeft   = ( ::nWidth * 1.167 ) - ::nHeight
      end
// add above 3 lines
      ::oBtn:lCancel = .T. // so the GET VALID is not fired when the button is focused

      /*
      // We force a WM_NCCALCSIZE msg to be sent to the GET      
      SetWindowPos( ::hWnd, 0, 0, 0, 0, 0,;
                    nOr( SWP_NOMOVE, SWP_NOSIZE, SWP_NOZORDER, SWP_FRAMECHANGED ) )
      */
             
   endif  
   
return nil  
 
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: BTNGET vs GET..ACTION..BITMAP

Postby Ugo » Tue Mar 03, 2009 10:29 am

Dear Dutch,

the position work well,
thank you.

> I've changed all BTNGET to original GET..ACTION and working without problem
I have a problem, test this (with BTNGET work well):
Code: Select all  Expand view
FUNCTION Main()

   LOCAL o := MyClass():New()

   RETURN Nil

CLASS MyClass
   DATA dData
   METHOD New() CONSTRUCTOR

   ENDCLASS

METHOD New() CLASS MyClass

   LOCAL oGet4, lWhen := .T., oDlg

   ::dData := Date()

   DEFINE DIALOG oDlg

   @ 1, 1 GET oGet4 VAR ::dData OF oDlg PICTURE "@D";  // RESOURCE "B_Cld"
            SIZE 50, 12 ;
            ACTION (::dData:=Date()-10)

   ACTIVATE DIALOG oDlg
   RETURN Self

return an error when i click button. :-(

This is the error:
Descrizione: Warning BASE/1005 Message not found: TGET:_DDATA
Args:

Stack Calls
===========
Called from: source\rtl\tobject.prg => TGET:ERROR(172)
Called from: source\rtl\tobject.prg => TGET:MSGNOTFOUND(205)
Called from: source\rtl\tobject.prg => TGET:_DDATA(0)
Called from: SRC-WIN\TEst\Source\Test.prg => (b)MYCLASS:NEW(82)
Called from: prg\TGET.prg => (b)TGET:CREATEBUTTON(465)
Called from: prg\BUTTON.prg => TBUTTONBMP:CLICK(177)
Called from: prg\CONTROL.prg => TBUTTON:HANDLEEVENT(1412)
Called from: prg\BUTTONB.prg => TBUTTONBMP:HANDLEEVENT(168)
Called from: prg\WINDOW.prg => _FWH(3345)
Called from: => SENDMESSAGE(0)
Called from: prg\WINDOW.prg => TGET:COMMAND(1014)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: prg\CONTROL.prg => TCONTROL:HANDLEEVENT(1454)
Called from: prg\TGET.prg => TGET:HANDLEEVENT(561)
Called from: prg\WINDOW.prg => _FWH(3345)
Called from: => DIALOGBOXINDIRECT(0)
Called from: prg\DIALOG.prg => TDIALOG:ACTIVATE(273)
Called from: SRC-WIN\TEst\Source\Test.prg => MYCLASS:NEW(84)
Called from: SRC-WIN\TEst\Source\Test.prg => MAIN(60)


There is a workaround?

Is possible to insert also the resources?

Many thanks in advance.
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: BTNGET vs GET..ACTION..BITMAP

Postby Enrico Maria Giordano » Tue Mar 03, 2009 6:38 pm

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


FUNCTION Main()

   LOCAL o := MyClass():New()

   RETURN Nil

CLASS MyClass
   DATA dData
   METHOD New() CONSTRUCTOR

   ENDCLASS

METHOD New() CLASS MyClass

   LOCAL oGet4, lWhen := .T., oDlg, oSelf := Self

   ::dData := Date()

   DEFINE DIALOG oDlg

   @ 1, 1 GET oGet4 VAR ::dData OF oDlg PICTURE "@D";  // RESOURCE "B_Cld"
            SIZE 50, 12 ;
            ACTION (oSelf:dData:=Date()-10)

   ACTIVATE DIALOG oDlg
   RETURN Self


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8398
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: BTNGET vs GET..ACTION..BITMAP

Postby Ugo » Tue Mar 03, 2009 11:43 pm

Dear Enrico,

work well, of course! :wink:
thank you.

This is a bug?
The other clauses (valid,spinner,when etc.) work well using directly the class variable.

There is also the RESOURCE
How to use the resource instead bitmap image?
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: BTNGET vs GET..ACTION..BITMAP

Postby Enrico Maria Giordano » Wed Mar 04, 2009 8:05 am

Ugo wrote:This is a bug?


It seems not. Look inside tget.prg, method CreateButton() and you will see that the same technique is used there. I tried it under Harbour with the same result (the local variable is still required).

Ugo wrote:There is also the RESOURCE
How to use the resource instead bitmap image?


It is not supported yet. You have to modify CreateButton() method for this. Antonio?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8398
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: BTNGET vs GET..ACTION..BITMAP

Postby Ugo » Wed Mar 04, 2009 8:32 am

Enrico Maria Giordano wrote:
Ugo wrote:This is a bug?


It seems not. Look inside tget.prg, method CreateButton() and you will see that the same technique is used there. I tried it under Harbour with the same result (the local variable is still required).

Ugo wrote:The other clauses (valid,spinner,when etc.) work well using directly the class variable

Dear Enrico,
Test it:
Code: Select all  Expand view
FUNCTION Main()
   LOCAL o

   Set century on
   SET EPOCH TO 2000

   o := MyClass():New()

   RETURN Nil

CLASS MyClass
   DATA dData
   DATA lTest INIT .T.

   METHOD New() CONSTRUCTOR

   ENDCLASS

METHOD New() CLASS MyClass

   LOCAL oGet4, lWhen := .T., oDlg, oSelf := Self, cTxt := Space( 10 ), oGet5

   ::dData := Date()

   DEFINE DIALOG oDlg

   @ 1, 1 GET oGet4 VAR ::dData OF oDlg PICTURE "@D";  // RESOURCE "B_Cld"
            SIZE 50, 12 ;
            WHEN ::lTest;
            VALID IF( ::lTest,;
                      IF( MyTest( ::dData ),;
                        ( MsgInfo( "Test OK", ::dData ), .T. ),;
                        ( MsgInfo( "Test KO", ::dData ), .F. ) ),;
                        .T. );
            ACTION (oSelf:dData:=Date()-10)

   @ 3, 1 GET oGet5 VAR cTxt OF oDlg

   ACTIVATE DIALOG oDlg
   RETURN Self

STATIC FUNCTION MyTest( dData )

   MsgInfo( "Test in corso" + CRLF + ;
            DToS( dData ) + " < " + DToS( Date() ) + CRLF + ;
            cValToChar( dData < Date() ) , dData )

   RETURN dData < Date()


as you can see, both the variable ::lTest that the same ::dData work well in the When and Valid clauses, only Action required oSelf.
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: BTNGET vs GET..ACTION..BITMAP

Postby Ugo » Wed Mar 04, 2009 8:34 am

Enrico Maria Giordano wrote:
Ugo wrote:There is also the RESOURCE
How to use the resource instead bitmap image?


It is not supported yet. You have to modify CreateButton() method for this. Antonio?


Antonio,
can you help me?
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: BTNGET vs GET..ACTION..BITMAP

Postby Enrico Maria Giordano » Wed Mar 04, 2009 9:47 am

Ugo wrote:Dear Enrico,
Test it:


Interesting... It seems I was wrong. If I change the last line of @ row, col GET ... ACTION command in fivewin.ch:

Code: Select all  Expand view
<.pass.>, [<.lNoBorder.>], <nHelpId>,,,,,, <{uAction}>, <cBmpName>, <"uVar"> )


then it works fine.

Antonio?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8398
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 92 guests