BUTTON question?

BUTTON question?

Postby dutch » Mon Aug 28, 2006 6:09 am

Dear Antonio,

1. BUTTON class does still support CRLF for seperate line?
2. BUTTON Caption can define left alignment?

Best regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Mon Aug 28, 2006 9:20 am

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
regards, saludos

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

Postby Enrico Maria Giordano » Mon Aug 28, 2006 9:35 am

Even from code:

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Mon Aug 28, 2006 9:43 am

Ops, sorry, I wasn't aware that this is the FWPCC forum. But maybe it could still work.

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

Postby Enrico Maria Giordano » Mon Aug 28, 2006 9:58 am

It works with DIALOGs but not with WINDOWs and I don't know why:

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

It works perfect.

Postby dutch » Mon Aug 28, 2006 11:05 am

Dear Antonio&Enrico,

It works perfect now.

#define BS_MULTILINE 8192 and CR CHR(13)

Best regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Mon Aug 28, 2006 11:15 am

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.
regards, saludos

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

Postby Enrico Maria Giordano » Mon Aug 28, 2006 11:41 am

I already tried with WINDOW and ON INIT clause to no avail.

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

Postby Antonio Linares » Mon Aug 28, 2006 11:44 am

Enrico,

In a window it may work using SetWindowLong( oButton:hWnd, GWL_STYLE, nOr( GetWindowLong( oButton:hWnd, GWL_STYLE ), BS_... ) )
regards, saludos

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

Postby Enrico Maria Giordano » Mon Aug 28, 2006 11:58 am

Confirmed!

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

#DefineBS_LEFTTET 32 is not working?

Postby dutch » Mon Aug 28, 2006 12:03 pm

Dear Antonio&Enrico,

This code does not work.

oBtn:nStyle := NOR( oBtn:nStyle, BS_LEFTTEXT )

Best regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Mon Aug 28, 2006 12:11 pm

Dutch,

Please try it as Enrico's sample code.
regards, saludos

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

BUTTON question again?

Postby dutch » Tue Aug 29, 2006 11:14 am

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 view  RUN
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
Code: Select all  Expand view  RUN
Code: Select all  Expand view  RUN
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Tue Aug 29, 2006 12:36 pm

Dutch,

Try this:

oBtn:SetText( "Next Caption" )
regards, saludos

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

It works ok now.

Postby dutch » Tue Aug 29, 2006 5:43 pm

Dear Antonio,

It works perfect now.

Thanks&Regards,
Dutch
User avatar
dutch
 
Posts: 1543
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 28 guests