Page 1 of 1
BUTTON question?
Posted: Mon Aug 28, 2006 6:09 am
by dutch
Dear Antonio,
1. BUTTON class does still support CRLF for seperate line?
2. BUTTON Caption can define left alignment?
Best regards,
Dutch
Posted: Mon Aug 28, 2006 9:20 am
by Antonio Linares
Dutch,
> 1. BUTTON class does still support CRLF for seperate line?
Only if you use it from resource and you use this style:
#define BS_MULTILINE 1024
> 2. BUTTON Caption can define left alignment?
Same as above but using BS_LEFTTEXT
Posted: Mon Aug 28, 2006 9:35 am
by Enrico Maria Giordano
Even from code:
Code: Select all | Expand
#include "Fivewin.ch"
#define CR CHR( 13 )
#define BS_MULTILINE 8192
FUNCTION MAIN()
LOCAL oDlg, oBtn
DEFINE DIALOG oDlg
@ 1, 1 BUTTON oBtn PROMPT "&Close" + CHR( 13 ) + "the dialog";
SIZE 50, 30;
ACTION oDlg:End()
oBtn:nStyle = NOR( oBtn:nStyle, BS_MULTILINE )
ACTIVATE DIALOG oDlg;
CENTER
RETURN NIL
EMG
Posted: Mon Aug 28, 2006 9:43 am
by Enrico Maria Giordano
Ops, sorry, I wasn't aware that this is the FWPCC forum. But maybe it could still work.
EMG
Posted: Mon Aug 28, 2006 9:58 am
by Enrico Maria Giordano
It works with DIALOGs but not with WINDOWs and I don't know why:
Code: Select all | Expand
#include "Fwce.ch"
#define BS_MULTILINE 8192
FUNCTION MAIN()
LOCAL oDlg, oBtn
DEFINE DIALOG oDlg
@ 1, 1 BUTTON oBtn PROMPT "&Close" + CHR( 13 ) + "the dialog";
SIZE 50, 30;
ACTION oDlg:End()
oBtn:nStyle = NOR( oBtn:nStyle, BS_MULTILINE )
ACTIVATE DIALOG oDlg
RETURN NIL
EMG
It works perfect.
Posted: Mon Aug 28, 2006 11:05 am
by dutch
Dear Antonio&Enrico,
It works perfect now.
#define BS_MULTILINE 8192 and CR CHR(13)
Best regards,
Dutch
Posted: Mon Aug 28, 2006 11:15 am
by Antonio Linares
Enrico,
> It works with DIALOGs but not with WINDOWs and I don't know why:
Because in dialogs, the control style is used when building the dialog.
In a window, the window already exists and the control is created later on.
Posted: Mon Aug 28, 2006 11:41 am
by Enrico Maria Giordano
I already tried with WINDOW and ON INIT clause to no avail.
EMG
Posted: Mon Aug 28, 2006 11:44 am
by Antonio Linares
Enrico,
In a window it may work using SetWindowLong( oButton:hWnd, GWL_STYLE, nOr( GetWindowLong( oButton:hWnd, GWL_STYLE ), BS_... ) )
Posted: Mon Aug 28, 2006 11:58 am
by Enrico Maria Giordano
Confirmed!
Code: Select all | Expand
#include "Fwce.ch"
#define GWL_STYLE -16
#define BS_MULTILINE 8192
FUNCTION MAIN()
LOCAL oWnd, oBtn
DEFINE WINDOW oWnd
@ 1, 1 BUTTON oBtn PROMPT "&Close" + CHR( 13 ) + "the window";
SIZE 60, 50;
ACTION oWnd:End()
ACTIVATE WINDOW oWnd;
ON INIT SETWINDOWLONG( oBtn:hWnd, GWL_STYLE, NOR( GETWINDOWLONG( oBtn:hWnd, GWL_STYLE ), BS_MULTILINE ) )
RETURN NIL
EMG
#DefineBS_LEFTTET 32 is not working?
Posted: Mon Aug 28, 2006 12:03 pm
by dutch
Dear Antonio&Enrico,
This code does not work.
oBtn:nStyle := NOR( oBtn:nStyle, BS_LEFTTEXT )
Best regards,
Dutch
Posted: Mon Aug 28, 2006 12:11 pm
by Antonio Linares
Dutch,
Please try it as Enrico's sample code.
BUTTON question again?
Posted: Tue Aug 29, 2006 11:14 am
by dutch
Dear Antonio,
Can I change oBtn:cCaption that create from source code in FWPPC. In FW/Clipper I do it from Resource and change :cCaption and :Refresh(). It works ok but I try with FWPPC. It doesn't change.
oBtn:cCaption := 'Next Caption"
oBtn:Show()
oBtn:Refresh()
Example
======
Code: Select all | Expand
DEFINE DIALOG oDlg FROM 0, 0.2 TO nHeight,nWidth ;
PIXEL
for n := 1 to 21
MakeBtn( n, oDlg, nRow, nCol, aPost )
if nRow >= 72
nRow := 0
nCol += 36
else
nRow += 12
end
next
@ 96.8,85 BTNBMP FILENAME (cPath+"ARRUP.BMP") ;
SIZE 23,13 ;
WHEN (nPage>1) ;
ACTION KeyPage( oDlg, aPost, .T. , .F. )
@ 110,85 BTNBMP FILENAME (cPath+"ARRDN.BMP") ;
SIZE 23,12 ;
WHEN (nEndPage=0) ;
ACTION KeyPage( oDlg, aPost, .F. , .T. )
Return
*------------------*
Static Procedure MakeBtn(n,oDlg,nRow,nCol,aPost)
if empty(ACT->ACCT_CODE)
MadeBtn( n, oDlg, nRow, nCol, ACT->ACCT_CODE, rtrim(ACT- >ACCT_EDESC ), ACT->ACCT_TYPE, aPost )
end
ACT->(DbSkip())
*----------------------------*
Procedure MaeBtn( n, oDlg, nRow, nCol, cTrn, cDesc, cType, aPost )
if !empty(cTrn)
@ (nRow), (nCol) BUTTON oBtns[n] ;
PROMPT left(cDesc,14) ;
FONT oFnts ;
SIZE 35, 12 ;
PIXEL ;
ACTION ( aadd( aPost,{ str(len(aPost)+1,2), cDesc, str(iif (empty(cQty),1,val(cQty)),7,2), cTrn } ), (cQty := '') )
oBtns[n]:nStyle := NOR( oBtns[n]:nStyle, BS_MULTILINE )
else
@ (nRow), (nCol) BUTTON oBtns[n] ;
FONT oFnts ;
SIZE 35, 12 ;
PIXEL
end
return
*------------------*
Function KeyPage( oDlg, aPost, lPrev, lNext )
local n, nRow, nCol
local lChk := .F.
local nMultiple := 2
local cCap, aMenuItems := {}
if (nPage > 1 .and. lPrev) .or. (nEndPage=0.and.lNext)
if lNext
nPage += 1
elseif lPrev
nPage -= 1
ACT->(DbGoTop())
if nPage > 1
ACT->(DbSkip((nPage-1)*21))
end
end
for n := 1 to 21
if !empty(ACT->ACCT_CODE)
aadd( aMenuItems, { ACT->ACCT_CODE , rtrim(ACT->ACCT_EDESC) } )
else
oBtns[n]:Hide()
oBtns[n]:Refresh()
end
if !empty(ACT->ACCT_CODE)
ACT->(DbSkip())
end
next
end
// Last page checking
if !empty(ACT->ACCT_CODE)
if nEndPage > 0
nEndPage -= nEndPage
end
end
for n := 1 to len(aMenuItems)
ShowMenu( aMenuItems, n )
next
return
*--------------------------------*
Function ShowMenu( aMenuItems, n )
local cCap, cTrn
cTrn := aMenuItems[n][1]
cCap := left( aMenuItems[n][2], 28 )
oBtns[n]:cCaption := cCap
oBtns[n]:bAction := {|| ( aadd( aPost,{ str(len(aPost)+1,2), cCap , str(iif(empty(cQty),1,val(cQty)),7,2), } ), (cQty := '') ) }
oBtns[n]:Show()
oBtns[n]:Refresh()
return
Best regards,
Dutch
Posted: Tue Aug 29, 2006 12:36 pm
by Antonio Linares
Dutch,
Try this:
oBtn:SetText( "Next Caption" )
It works ok now.
Posted: Tue Aug 29, 2006 5:43 pm
by dutch
Dear Antonio,
It works perfect now.
Thanks&Regards,
Dutch