Label new

Label new

Postby Silvio.Falconi » Fri Jan 27, 2017 6:29 pm

Some have a procedure to design a label ? (or can help me to create a small designer for labels )
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Antonio Linares » Sat Jan 28, 2017 10:51 am

Silvio,

You may use samples\design.prg as a start
regards, saludos

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

Re: Label new

Postby Silvio.Falconi » Sun Jan 29, 2017 10:39 am

of course I had already thought.
For now, my problem is to set the size of the labels and I had thought of putting in a dialog to another (for viewing the label) then I tried it with a Bitmap, and then also with a tpanel .What I could use for displaying the label in a visual way?
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Silvio.Falconi » Sun Jan 29, 2017 7:53 pm

Antonio,
I made some tests...

Please see it
why not refresh the metafile sizes ?

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

Function main()

Local oBar
Local oWnd
Local oLabelDesign
Local oLabelHeight := 400
Local oLabelWidth  := 200
Local oLabelName   := "Test.lbl"

Local aGet[10]

//--------------------------------------------------------------------//

DEFINE WINDOW oWnd TITLE "Label Design"  Vscroll

DEFINE BUTTONBAR oBar OF oWnd SIZE 80, 80 2015 BOTTOM

@ 20,10 SAY "Label Height :"  of oWnd  size 100,20   PIXEL
@ 44,10 SAY "Label Width :"   of oWnd  size 100,20  PIXEL
@ 20,410 SAY "Label Name :"  of oWnd  size 100,20   PIXEL

@ 20, 125 GET aGet[1] VAR  oLabelHeight  of oWnd  size 60,20 SPINNER PIXEL  on change Refresh_oLabel(oLabelDesign,oLabelHeight, oLabelWidth)
@ 44, 125 GET aGet[2] VAR  oLabelWidth  of oWnd  size 60,20  SPINNER PIXEL  on change Refresh_oLabel(oLabelDesign,oLabelHeight, oLabelWidth)
@ 20, 510 GET aGet[3] VAR  oLabelName  of oWnd  size 120,20   PIXEL

 oLabelDesign :=TMetaFile():New( 200, 200, oLabelHeight, oLabelWidth,,oWnd,CLR_BLACK,CLR_WHITE,)



 ACTIVATE WINDOW oWnd center  ;
            ON INIT  (CreateSay( oLabelDesign ))
 return nil


 //--------------------------------------------------------------------//
 Function Refresh_oLabel(oBjeto,oLabelHeight, oLabelWidth)
    oBjeto:nHeight:= oLabelHeight
    oBjeto:nWidth:=  oLabelWidth

    oBjeto:setsize(oLabelHeight, oLabelWidth)
     oBjeto:refresh()
 
    return nil
//--------------------------------------------------------------------//

  function CreateSay( oDlg )

   local oSay

   @ 1, 2 SAY oSay PROMPT "Label:" OF oDlg SIZE 70, 20 DESIGN BORDER

   oSay:bGet = nil
   oSay:lWantClick = .T.
   BringWindowToTop( oSay:hWnd )
   oSay:SetFocus()
   
  * oSay:bRClicked = { | nRow, nCol | EditControl( nRow, nCol, oSay ) }
   
return nil  
 



I tried with setsize,refresh and setfocus
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby horacio » Sun Jan 29, 2017 10:12 pm

Prueba así
Code: Select all  Expand view

 //--------------------------------------------------------------------//
 Function Refresh_oLabel(oBjeto,oLabelHeight, oLabelWidth,oWnd)
    oBjeto:nHeight:= oLabelHeight
    oBjeto:nWidth:=  oLabelWidth

    oBjeto:setsize(oLabelHeight, oLabelWidth)
     oBjeto:refresh()
     oWnd:Refresh()
    return nil
 


Saludos
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Label new

Postby Silvio.Falconi » Mon Jan 30, 2017 8:32 am

NOT RUN not refresh... the object oLabelDesign
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Antonio Linares » Mon Jan 30, 2017 8:43 am

Silvio,

Why do you want to use a TMetaFile object there ?
regards, saludos

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

Re: Label new

Postby Silvio.Falconi » Mon Jan 30, 2017 9:16 am

because I wish emulate a label print
I tried with a dialog or tpanel but I not have success
if you want give a hand ( help) yo're welcome
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Antonio Linares » Mon Jan 30, 2017 12:12 pm

What problem do you get with a TPanel ?
regards, saludos

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

Re: Label new

Postby Silvio.Falconi » Mon Jan 30, 2017 2:23 pm

Antonio I not remember wich error tpanel gave me ..

My Idea ..... (I use a xbrowse with customer.dbf to import fields)

Image


it can run only when I Preview the label on rpreview the label is not as the size I have on the screen ...can you help me ?

Image









My test
Code: Select all  Expand view


#include "fivewin.ch"
#include "Constant.ch"

#Define Label_extension  ".LBL"





REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO


 Static oLabelDesign,nLabelHeight,nLabelWidth ,cLabelName


Function Test()

   local oDlg, oBrw, oFont
   Local oBtnLabel[2]

   SET DATE ITALIAN
   SET CENTURY ON

   FwNumFormat( 'E', .t. )

   USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Windows 7 Bars' ;
      COLOR CLR_BLACK,RGB(250,250,250)

   @ 10,20 XBROWSE oBrw OF oDlg SIZE -10,-20 PIXEL ;
      COLUMNS "First","Last","Street","City", "State", "Zip","HireDate","Age", "Salary" ;
      ALIAS 'CUST' NOBORDER

   oBrw:lRecordSelector := .f.
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7

   WITH OBJECT oBrw:InsCol( 1 )

      :cHeader       := " "
      :bEditValue    := { || If( AScan( oBrw:aSelected, oBrw:BookMark ) > 0, .t., nil ) }
      :SetCheck()
      :nHeadBmpNo    := { || If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }
      :bLClickHeader := { |r,c,f,oCol| If( Len( oBrw:aSelected ) == oBrw:nLen, ;
                                           oBrw:SelectNone(), oBrw:SelectAll() ) }

   END

   oBrw:CreateFromCode()

   @ 204,2 BUTTON oBtnLabel Prompt "Label Manager" SIZE 60,10 PIXEL;
             ACTION Label_Manager('CUST',oBrw,'CUST')



   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont
   Return nil

 //---------------------------------------------------------------------//


   Function Label_Manager(cDbf,oGrid,cPref)


Local oBar
Local oWnd


Local lPrintFrame  := .t.

  Local  nLblVSep   := 0
  Local  nLblHSep   := 0
  Local  nLblOnLine := 0


        Local   nLen := Len( oGrid:aCols )
        Local   aCampos [ nLen ]
        Local   aTitulos[ nLen ]
        Local   aTipos  [ nLen ]

        Local cField


Local aGet[10]
Local oHand

//---------------------------------------------------------------------//
 RddSetDefault( "DBFCDX" )

   SetHandleCount( 100 )
//--------------------------------------------------------------------//


        FOR n = 1 TO nLen
           aCampos   [ n ]:= oGrid:aCols[ n ]:cExpr
           aTitulos  [ n ]:= oGrid:aCols[ n ]:cHeader
           aTipos    [ n ]:= oGrid:aCols[ n ]:cDataType
       NEXT



DEFAULT  nLabelHeight := 400
DEFAULT  nLabelWidth  := 650


 cLabelName   := "Test.lbl"

DEFINE CURSOR oHand HAND
DEFINE WINDOW oWnd TITLE "Label Design"  Vscroll

DEFINE BUTTONBAR oBar OF oWnd SIZE 40, 40 2015
      oBar:bRClicked := { || .t. }
      oBar:oCursor:=  oHand

DEFINE BUTTON OF oBar ;
     FILENAME "PRINT.BMP"       ;
     ACTION Preview(lPrintFrame ) ;
     TOOLTIP i18n( "Preview Label. " ) ;
     MESSAGE i18n( "Preview Label." ) ;
      NOBORDER






@ 60,10 SAY "Label Height :"  of oWnd  size 100,20   PIXEL
@ 80,10 SAY "Label Width :"   of oWnd  size 100,20  PIXEL
@ 60,410 SAY "Label Name :"  of oWnd  size 100,20   PIXEL

@ 100, 410 say "Horizontal Separator (mm):"  of oWnd  size 180,20   PIXEL
@ 125, 410 say "Vertical Separator (mm):"  of oWnd  size 180,20   PIXEL








@ 60, 125 GET aGet[1] VAR  nLabelHeight   of oWnd  size 60,20 SPINNER PIXEL  on change Refresh_oLabel(oWnd)
@ 84, 125 GET aGet[2] VAR  nLabelWidth  of oWnd  size 60,20  SPINNER PIXEL  on change Refresh_oLabel(oWnd)
@ 60, 510 GET aGet[3] VAR  cLabelName   of oWnd  size 120,20   PIXEL

@ 100, 600 GET aGet[4] VAR  nLblHSep  of oWnd  size 60,20 SPINNER PIXEL
@ 125, 600 GET aGet[5] VAR  nLblVSep   of oWnd  size 60,20  SPINNER PIXEL



 oLabelDesign :=TMetaFile():New( 200, 200,nLabelWidth, nLabelHeight, ,oWnd,CLR_BLACK,CLR_WHITE,)
            oLabelDesign:bRClicked  := {|nRow,nCol,nFlags|EditDialog( nRow, nCol, oLabelDesign )}


    @ 2.17, 130 say "Select Fields:"   OF oBar   SIZE 120,20 PIXEL
    @ 2.17,259   COMBOBOX aGet[10] VAR cField     ITEMS aTitulos      OF oBar   SIZE 200,90 PIXEL  STYLE CBS_DROPDOWN ;
   on change CreateSay( cField,  oLabelDesign )





 ACTIVATE WINDOW oWnd center

 return nil


 //--------------------------------------------------------------------//
 Function Refresh_oLabel(oWnd)
     oLabelDesign:nHeight:= nLabelHeight
     oLabelDesign:nWidth:=  nLabelWidth
     oLabelDesign:setsize(nLabelWidth,nLabelHeight, )
     oLabelDesign:refresh()
     oWnd:refresh()
    return nil
//--------------------------------------------------------------------//

  function CreateSay(cTesto, oDlg )

   local oSay
   local oFontName := TFont():New( "ARIAL", 0, -24,,,,,,,,,,,,, , )

IF !empty(cTesto)
   @ 1, 2 SAY oSay PROMPT "<" +cTesto+">" OF oDlg SIZE 150, 40 DESIGN BORDER  FONT oFontName

   oSay:bGet = nil
   oSay:lWantClick = .T.
   BringWindowToTop( oSay:hWnd )
   oSay:SetFocus()

   oSay:bRClicked = { | nRow, nCol | EditControl( nRow, nCol, oSay ) }
Endif

return nil


//---------------------------------------------------------------------------------------//
function EditControl( nRow, nCol, oControl )

   local oMenu

   MENU oMenu POPUP
      MENUITEM "Bring to front" ACTION BringWindowToTop( oControl:hWnd )



      MENUITEM "Position"
      MENU
         MENUITEM "nTop"    + Chr( 9 ) + LTrim( Str( oControl:nTop ) )
         MENUITEM "nLeft"   + Chr( 9 ) + LTrim( Str( oControl:nLeft ) )
         MENUITEM "Move up"   ACTION ( oControl:HideDots(), oControl:nTop--, oControl:ShowDots() )
         MENUITEM "Move down" ACTION ( oControl:HideDots(), oControl:nTop++, oControl:ShowDots() )
      ENDMENU

      MENUITEM "Size"
      MENU
         MENUITEM "nWidth"  + Chr( 9 ) + LTrim( Str( oControl:nWidth ) )
         MENUITEM "nHeight" + Chr( 9 ) + LTrim( Str( oControl:nHeight ) )
      ENDMENU
   ENDMENU

   ACTIVATE POPUP oMenu WINDOW oControl AT nRow, nCol

return nil

function Preview(lPrintFrame )

   local oPrn, oCtrl, oBrush, oFont
   local n
   oWndChild:=oLabelDesign

   PRINTER oPrn PREVIEW NAME cLabelName
   PAGE

         aDes:=  oPrn:Pix2Cmtr( oWndChild:nBottom, oWndChild:nRight )


   if lPrintFrame
        oPrn:Box( 10, 10, oWndChild:nBottom, oWndChild:nRight, )
    Endif






         if ! Empty( oWndChild:aControls )
         for n = 1 to Len( oWndChild:aControls )
            oCtrl = oWndChild:aControls[ n ]

            do case
            case oCtrl:ClassName() == "TSAY"


                    SetBkColor( oPrn:hDcOut, oCtrl:nClrPane )

                    DEFINE BRUSH oBrush COLOR oCtrl:nClrPane

                    FillRect( oPrn:hDcOut, { oCtrl:nTop, oCtrl:nLeft,;
                              oCtrl:nTop + oCtrl:nHeight - 1,;
                              oCtrl:nLeft + oCtrl:nWidth - 1 }, oBrush:hBrush )

                    oBrush:End()

                    oCtrl:GetFont()

                    DEFINE FONT oFont NAME oCtrl:oFont:cFaceName ;
                       SIZE oCtrl:oFont:nWidth, oCtrl:oFont:nHeight ;
                       OF oPrn

                    oFont:Activate( oPrn:hDCOut )

                    TextOut( oPrn:hDcOut,;
                             oCtrl:nTop,;
                             oCtrl:nLeft,;
                             oCtrl:GetText() )


                    oFont:DeActivate( oPrn:hDCOut )
                    oFont:End()

               case oCtrl:ClassName() == "TBITMAP"
                    oPrn:SayBitmap( oCtrl:nTop,;
                                    oCtrl:nLeft,;
                                    oCtrl:cFileName, 80, 80 )
            endcase
         next
         endif
      ENDPAGE
   ENDPRINTER

   return nil









//-----------------------------------------------------------------------------------------//

  static function EditDialog( nRow, nCol, oControl )

   local oMenu

   MENU oMenu POPUP
      MENUITEM "Title..." ACTION NIL //EditTitle( oDlg )

      SEPARATOR

      MENUITEM "Add field"  ACTION NIL

      SEPARATOR

   ENDMENU

     endmenu

   ACTIVATE POPUP oMenu WINDOW oControl AT nRow, nCol // SAVE

return nil

 
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Antonio Linares » Tue Jan 31, 2017 8:57 am

Silvio,

Use ExtTextOut() instead of TextOut(), so you can specify the width and height
regards, saludos

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

Re: Label new

Postby Silvio.Falconi » Wed Feb 01, 2017 10:12 pm

ok now it is ok
but the label on the preview have not the same dimension of that the screen

Code: Select all  Expand view



#include "fivewin.ch"
#include "Constant.ch"

#Define Label_extension  ".LBL"



REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO


 Static oLabelDesign,nLabelHeight,nLabelWidth ,cLabelName


Function Test()

   local oDlg, oBrw, oFont
   Local oBtnLabel[2]

   SET DATE ITALIAN
   SET CENTURY ON

   FwNumFormat( 'E', .t. )

   USE CUSTOMER ALIAS CUST

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse Windows 7 Bars' ;
      COLOR CLR_BLACK,RGB(250,250,250)

   @ 10,20 XBROWSE oBrw OF oDlg SIZE -10,-20 PIXEL ;
      COLUMNS "First","Last","Street","City", "State", "Zip","HireDate","Age", "Salary" ;
      ALIAS 'CUST' NOBORDER

   oBrw:lRecordSelector := .f.
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLWIN7

   WITH OBJECT oBrw:InsCol( 1 )

      :cHeader       := " "
      :bEditValue    := { || If( AScan( oBrw:aSelected, oBrw:BookMark ) > 0, .t., nil ) }
      :SetCheck()
      :nHeadBmpNo    := { || If( Len( oBrw:aSelected ) == oBrw:nLen, 1, 2 ) }
      :bLClickHeader := { |r,c,f,oCol| If( Len( oBrw:aSelected ) == oBrw:nLen, ;
                                           oBrw:SelectNone(), oBrw:SelectAll() ) }

   END

   oBrw:CreateFromCode()

   @ 204,2 BUTTON oBtnLabel Prompt "Label Manager" SIZE 60,10 PIXEL;
             ACTION Label_Manager('CUST',oBrw,'CUST')



   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont
   Return nil

 //---------------------------------------------------------------------//


   Function Label_Manager(cDbf,oGrid,cPref)


Local oBar
Local oWnd


Local lPrintFrame  := .t.

  Local  nLblVSep   := 0
  Local  nLblHSep   := 0
  Local  nLblOnLine := 0


        Local   nLen := Len( oGrid:aCols )
        Local   aCampos [ nLen ]
        Local   aTitulos[ nLen ]
        Local   aTipos  [ nLen ]

        Local cField


Local aGet[10]
Local oHand

//---------------------------------------------------------------------//
 RddSetDefault( "DBFCDX" )

   SetHandleCount( 100 )
//--------------------------------------------------------------------//


        FOR n = 1 TO nLen
           aCampos   [ n ]:= oGrid:aCols[ n ]:cExpr
           aTitulos  [ n ]:= oGrid:aCols[ n ]:cHeader
           aTipos    [ n ]:= oGrid:aCols[ n ]:cDataType
       NEXT



DEFAULT  nLabelHeight := 400
DEFAULT  nLabelWidth  := 650


 cLabelName   := "Test.lbl"

DEFINE CURSOR oHand HAND
DEFINE WINDOW oWnd TITLE "Label Design"  Vscroll

DEFINE BUTTONBAR oBar OF oWnd SIZE 40, 40 2015
      oBar:bRClicked := { || .t. }
      oBar:oCursor:=  oHand

DEFINE BUTTON OF oBar ;
     FILENAME "PRINT.BMP"       ;
     ACTION Preview(lPrintFrame ) ;
     TOOLTIP i18n( "Preview Label. " ) ;
     MESSAGE i18n( "Preview Label." ) ;
      NOBORDER






@ 60,10 SAY "Label Height :"  of oWnd  size 100,20   PIXEL
@ 80,10 SAY "Label Width :"   of oWnd  size 100,20  PIXEL
@ 60,410 SAY "Label Name :"  of oWnd  size 100,20   PIXEL

@ 100, 410 say "Horizontal Separator (mm):"  of oWnd  size 180,20   PIXEL
@ 125, 410 say "Vertical Separator (mm):"  of oWnd  size 180,20   PIXEL








@ 60, 125 GET aGet[1] VAR  nLabelHeight   of oWnd  size 60,20 SPINNER PIXEL  on change Refresh_oLabel(oWnd)
@ 84, 125 GET aGet[2] VAR  nLabelWidth  of oWnd  size 60,20  SPINNER PIXEL  on change Refresh_oLabel(oWnd)
@ 60, 510 GET aGet[3] VAR  cLabelName   of oWnd  size 120,20   PIXEL

@ 100, 600 GET aGet[4] VAR  nLblHSep  of oWnd  size 60,20 SPINNER PIXEL
@ 125, 600 GET aGet[5] VAR  nLblVSep   of oWnd  size 60,20  SPINNER PIXEL



 oLabelDesign :=TMetaFile():New( 200, 200,nLabelWidth, nLabelHeight, ,oWnd,CLR_BLACK,CLR_WHITE,)
            oLabelDesign:bRClicked  := {|nRow,nCol,nFlags|EditDialog( nRow, nCol, oLabelDesign )}


    @ 2.17, 130 say "Select Fields:"   OF oBar   SIZE 120,20 PIXEL
    @ 2.17,259   COMBOBOX aGet[10] VAR cField     ITEMS aTitulos      OF oBar   SIZE 200,90 PIXEL  STYLE CBS_DROPDOWN ;
   on change CreateSay( cField,  oLabelDesign )





 ACTIVATE WINDOW oWnd center

 return nil


 //--------------------------------------------------------------------//
 Function Refresh_oLabel(oWnd)
     oLabelDesign:nHeight:= nLabelHeight
     oLabelDesign:nWidth:=  nLabelWidth
     oLabelDesign:setsize(nLabelWidth,nLabelHeight, )
     oLabelDesign:refresh()
     oWnd:refresh()
    return nil
//--------------------------------------------------------------------//

  function CreateSay(cTesto, oDlg )

   local oSay
   local oFontName := TFont():New( "ARIAL", 0, -24,,,,,,,,,,,,, , )

IF !empty(cTesto)
   @ 1, 2 SAY oSay PROMPT "<" +cTesto+">" OF oDlg SIZE 150, 40 DESIGN BORDER  FONT oFontName

   oSay:bGet = nil
   oSay:lWantClick = .T.
   BringWindowToTop( oSay:hWnd )
   oSay:SetFocus()

   oSay:bRClicked = { | nRow, nCol | EditControl( nRow, nCol, oSay ) }
Endif

return nil


//---------------------------------------------------------------------------------------//
function EditControl( nRow, nCol, oControl )

   local oMenu

   MENU oMenu POPUP
      MENUITEM "Bring to front" ACTION BringWindowToTop( oControl:hWnd )



      MENUITEM "Position"
      MENU
         MENUITEM "nTop"    + Chr( 9 ) + LTrim( Str( oControl:nTop ) )
         MENUITEM "nLeft"   + Chr( 9 ) + LTrim( Str( oControl:nLeft ) )
         MENUITEM "Move up"   ACTION ( oControl:HideDots(), oControl:nTop--, oControl:ShowDots() )
         MENUITEM "Move down" ACTION ( oControl:HideDots(), oControl:nTop++, oControl:ShowDots() )
      ENDMENU

      MENUITEM "Size"
      MENU
         MENUITEM "nWidth"  + Chr( 9 ) + LTrim( Str( oControl:nWidth ) )
         MENUITEM "nHeight" + Chr( 9 ) + LTrim( Str( oControl:nHeight ) )
      ENDMENU
   ENDMENU

   ACTIVATE POPUP oMenu WINDOW oControl AT nRow, nCol

return nil

function Preview(lPrintFrame )

   local oPrn, oCtrl, oBrush, oFont
   local n
   oWndChild:=oLabelDesign

   PRINTER oPrn PREVIEW NAME cLabelName
   PAGE

         aDes:=  oPrn:Pix2Cmtr( oWndChild:nBottom, oWndChild:nRight )


   if lPrintFrame
        oPrn:Box( 10, 10, oWndChild:nBottom, oWndChild:nRight, )
    Endif






         if ! Empty( oWndChild:aControls )
         for n = 1 to Len( oWndChild:aControls )
            oCtrl = oWndChild:aControls[ n ]

            do case
            case oCtrl:ClassName() == "TSAY"


                    SetBkColor( oPrn:hDcOut, oCtrl:nClrPane )

                    DEFINE BRUSH oBrush COLOR oCtrl:nClrPane

                    FillRect( oPrn:hDcOut, { oCtrl:nTop, oCtrl:nLeft,;
                              oCtrl:nTop + oCtrl:nHeight - 1,;
                              oCtrl:nLeft + oCtrl:nWidth - 1 }, oBrush:hBrush )

                    oBrush:End()

                    oCtrl:GetFont()

                    DEFINE FONT oFont NAME oCtrl:oFont:cFaceName ;
                       SIZE oCtrl:oFont:nWidth, oCtrl:oFont:nHeight ;
                       OF oPrn

                    oFont:Activate( oPrn:hDCOut )

                    ExtTextOut( oPrn:hDcOut,;
                             oCtrl:nTop,;
                             oCtrl:nLeft,;
                             oCtrl:GetText() )


                    oFont:DeActivate( oPrn:hDCOut )
                    oFont:End()

               case oCtrl:ClassName() == "TBITMAP"
                    oPrn:SayBitmap( oCtrl:nTop,;
                                    oCtrl:nLeft,;
                                    oCtrl:cFileName, 80, 80 )
            endcase
         next
         endif
      ENDPAGE
   ENDPRINTER

   return nil









//-----------------------------------------------------------------------------------------//

  static function EditDialog( nRow, nCol, oControl )

   local oMenu

   MENU oMenu POPUP
      MENUITEM "Title..." ACTION NIL //EditTitle( oDlg )

      SEPARATOR

      MENUITEM "Add field"  ACTION NIL

      SEPARATOR

   ENDMENU

     endmenu

   ACTIVATE POPUP oMenu WINDOW oControl AT nRow, nCol // SAVE

return nil










 
Last edited by Silvio.Falconi on Thu Feb 02, 2017 8:18 am, edited 1 time in total.
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Silvio.Falconi » Thu Feb 02, 2017 8:17 am

Someone can help me to create the design pls ?
I wish save the label on a file INI to load from a small class I made
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: Label new

Postby Antonio Linares » Thu Feb 02, 2017 10:41 am

Silvio,

You may multiply the width and height by some amount until they look as expected.

To create a INI file is very easy. You have examples in fivedit.prg, fivedbu.prg, etc
regards, saludos

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

Re: Label new

Postby Silvio.Falconi » Wed Feb 08, 2017 12:04 pm

Antonio Linares wrote:Silvio,

You may multiply the width and height by some amount until they look as expected.

To create a INI file is very easy. You have examples in fivedit.prg, fivedbu.prg, etc



Antonio,
I wish help to create this designer
To create Ini I not problems
I have problem to show the label into rpreview
I'm thinking to create a function using the procedure of label.prg and read the info from a file (ini) sample : test.lbl
When I create a control it open a property dialog and set the id of the control on file ini ocontrol:getid()
for the filed control must have some properties : font,align,positio xy and with, nheight , if normal or barcode
then I wish insert th epossibility to insert special characters , images and on future graphics control as line and box
do you think about ?
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: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests