btnbmp captions

Re: btnbmp captions

Postby ukoenig » Mon Jun 05, 2017 11:16 am

The sample is working fine.
I still did some changes :

1. File < PRODUCT.dbf > got a index on field < PRODUCTO >
2. Added the vars < cUP > and < cDOWN >
Building the button-array, I get the products of < UP > and < DOWN > as well.

OLD :

@ 10, 220 BTNBMP PROMPT "UP" FLAT SIZE 40,30 PIXEL OF oDlg ;
WHEN nFirstBtn >= 4 ;
ACTION ( nFirstBtn := Max( 0, nFirstBtn - 8 ), oDlg:Update() )

@ 45, 220 BTNBMP PROMPT "DOWN" FLAT SIZE 40,30 PIXEL OF oDlg ;
WHEN nFirstBtn + 8 < Len( aVariantes ) ;
ACTION ( nFirstBtn := Min( Len( aVariantes ) - 8, nFirstBtn + 8 ), ;
oDlg:Update() )

NEW :

@ 450, 530 BTNBMP PROMPT "UP" FLAT SIZE 80, 50 PIXEL OF oDlgMain ;
ACTION ( SETPRODUCT( cUP ), oDlgMain:Update() )

@ 505, 530 BTNBMP PROMPT "DOWN" FLAT SIZE 80, 50 PIXEL OF oDlgMain ;
ACTION ( SETPRODUCT( cDOWN ), oDlgMain:Update() )

Reaching EOF or BOF of table shows a message.

Image

The defined UP and DOWN-values :

Image

Code: Select all  Expand view

STATIC FUNCTION SETPRODUCT( cProduct )
LOCAL nLen

aVariantes := VA->( FW_DbfToArray( "ALLTRIM(DESC1),PRECIO,VARIANTE", { || FIELD->PRODUCTO = cProduct } ) )
nLen        := Len( aVariantes )
ASize( aVariantes, Max( 8, 4 * Max( 1, Ceiling( nLen / 4 ) ) ) )
AFill( aVariantes, { "", "", "" }, nLen + 1 )

nFirstBtn   := 0

// get UP-value
// ------------------
VA->( DBSEEK(cProduct) )
VA->( DBSKIP(-1) )
IF VA->( BOF() )
    MsgAlert( "BOF of table !!!", "Attention" )
ELSE
    cUP := FIELD->PRODUCTO
ENDIF

// get DOWN-value
// ----------------------
VA->( DBSEEK(cProduct) )
DO WHILE FIELD->PRODUCTO = cProduct
    VA->( DBSKIP(+1) )
ENDDO
IF VA->( EOF() )
    MsgAlert( "EOF of table !!!", "Attention" )
ELSE
    cDOWN := FIELD->PRODUCTO
ENDIF

RETURN NIL

 

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: btnbmp captions

Postby Silvio.Falconi » Mon Jun 05, 2017 3:45 pm

the modifications of Nages run ok now
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 115 guests