templates / plantillas

Postby Antonio Linares » Sun Nov 23, 2008 8:57 am

Jose Luis,

Code: Select all  Expand view

#include "FiveWin.ch"
#include "XBrowse.ch"

function Main()

   local oDlg, oBrw1, oCol, oBrw2

   USE Customer

   DEFINE DIALOG oDlg TITLE "Two xbrowses" SIZE 410, 200
   
   @ 0, 0 XBROWSE oBrw1 OF oDlg ALIAS "Customer" SIZE 100, 100
   
   oCol = oBrw1:AddCol()
   oCol:bStrData = { || Customer->First }
   oCol:cHeader = "First"
   
   oBrw1:CreateFromCode()

   USE Test NEW

   @ 0, 13 XBROWSE oBrw2 OF oDlg ALIAS "Test" SIZE 100, 100
   
   oCol = oBrw2:AddCol()
   oCol:bStrData = { || Test->( FieldGet( 1 ) ) }
   oCol:cHeader = "First"
   
   oBrw2:CreateFromCode()
   
   ACTIVATE DIALOG oDlg

return nil
 

Image
regards, saludos

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

Re: templates / plantillas

Postby Antonio Linares » Wed Feb 25, 2009 11:25 pm

A folder with a radio button menu, on a dialog:

test.prg
Code: Select all  Expand view

#include "FiveWin.ch"
 
function Main()
 
   local oDlg, oFld, nOption := 1, oRadMenu
   
   DEFINE DIALOG oDlg RESOURCE "Test"
 
   REDEFINE FOLDER oFld ;
      PROMPTS "One", "Two" ;
      DIALOGS "One", "Two" ;
      ID 100 OF oDlg

   REDEFINE RADIO oRadMenu VAR nOption ID 110, 120, 130 OF oFld:aDialogs[ 1 ] ;
      ON CHANGE MsgBeep()
     
   ACTIVATE DIALOG oDlg CENTERED
 
return nil
 


test.rc
Code: Select all  Expand view

#ifdef __FLAT__
   1 24 "WindowsXP.Manifest"
#endif
 
test DIALOG 17, 36, 185, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
 CONTROL "", 100, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 6, 175, 117
 DEFPUSHBUTTON "OK", 1, 67, 128, 50, 14
}
 
one DIALOG 6, 15, 175, 117
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
 CONTROL "&One", 110, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 10, 16, 30, 12
 CONTROL "&Two", 120, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 10, 28, 30, 12
 CONTROL "T&hree", 130, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 10, 40, 30, 12
}
 
two DIALOG 6, 15, 175, 117
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
}
 
regards, saludos

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

Re: templates / plantillas

Postby Antonio Linares » Sat Mar 07, 2009 12:45 pm

Template of a class to create a user defined control:

MyControl.prg
Code: Select all  Expand view
#include "FiveWin.ch"

CLASS TMyControl FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   METHOD New( nTop, nLeft, oWnd, nPos, nClrFore,;
               nClrBack, lPixel, lDesign, nWidth, nHeight,;
               cMsg, lVertical ) CONSTRUCTOR

   METHOD ReDefine( nId, oWnd ) CONSTRUCTOR

ENDCLASS

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

METHOD New( nTop, nLeft, oWnd, nPos, nClrFore, nClrBack, lPixel,;
            lDesign, nWidth, nHeight, cMsg, lVertical ) CLASS TMyControl

   DEFAULT nTop     := 0, nLeft := 0,;
           oWnd     := GetWndDefault(),;
           nClrFore := oWnd:nClrText,;
           nClrBack := GetSysColor( COLOR_BTNFACE ),;
           lPixel   := .f.,;
           lDesign  := .f.,;
           nWidth   := 200, nHeight := 21,;
           lVertical := .f.

   ::nStyle    = nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP )
   ::nId       = ::GetNewId()
   ::oWnd      = oWnd
   ::cMsg      = cMsg
   ::nTop      = If( lPixel, nTop, nTop * SAY_CHARPIX_H )
   ::nLeft     = If( lPixel, nLeft, nLeft * SAY_CHARPIX_W )
   ::nBottom   = ::nTop + nHeight - 1
   ::nRight    = ::nLeft + nWidth - 1
   ::lDrag     = lDesign
   ::lCaptured = .f.
   ::nClrText  = nClrFore
   ::nClrPane  = nClrBack

   ::Register()

   if ! Empty( oWnd:hWnd )
      ::Create()
      ::Default()
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

   if lDesign
      ::CheckDots()
   endif

return Self

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

METHOD ReDefine( nId, oWnd ) CLASS TMyControl

   DEFAULT oWnd := GetWndDefault()
   
   ::nId  = nId
   ::oWnd = oWnd

   ::Register()

   oWnd:DefControl( Self )

return Self

//----------------------------------------------------------------------------//
 
regards, saludos

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

Re: templates / plantillas

Postby Antonio Linares » Thu Dec 10, 2009 12:36 am

A dialog box from source code with a folder and several GETs and SAYs:

Code: Select all  Expand view
#include "FiveWin.ch"
 
function Main()
 
   local oDlg, oFld
   local cVar1 := "First GET   "
   local cVar2 := "Second GET  "
   local cVar3 := "Tercer GET  "  
   
   DEFINE DIALOG oDlg SIZE 400, 290
 
   @ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 115 ;
      PROMPTS "One", "Two", "Three"

   @ 1, 1.5 SAY "Say1" OF oFld:aDialogs[ 1 ]

   @ 2, 1 GET cVar1 OF oFld:aDialogs[ 1 ]

   @ 1, 1.5 SAY "Say2" OF oFld:aDialogs[ 2 ]

   @ 2, 1 GET cVar2 OF oFld:aDialogs[ 2 ]

   @ 1, 1.5 SAY "Say3" OF oFld:aDialogs[ 3 ]

   @ 2, 1 GET cVar3 OF oFld:aDialogs[ 3 ]
   
   @ 7, 10 BUTTON "&Ok" OF oDlg ACTION oDlg:End() SIZE 30, 12

   @ 7, 17 BUTTON "&Cancel" OF oDlg ACTION oDlg:End() SIZE 30, 12
     
   ACTIVATE DIALOG oDlg CENTERED
 
return nil
 
regards, saludos

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

Re: templates / plantillas

Postby Antonio Linares » Sun Apr 04, 2010 9:14 pm

Evaluate a codeblock from C code with no parameters:
Code: Select all  Expand view

   PHB_ITEM pBlock = hb_param( n, -1 );

   if( HB_IS_BLOCK( pBlock ) )
      hb_evalBlock0( pBlock );  
 
regards, saludos

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

Re: templates / plantillas

Postby Antonio Linares » Thu Apr 29, 2010 11:29 am

Showing a database record with a xbrowse:
Code: Select all  Expand view


#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oDlg, oBrw, oCol, aRecord, nAt := 1
   
   USE Customer
   
   aRecord = Array( Customer->( FCount() ) )
   
   DEFINE DIALOG oDlg SIZE 300, 300

   @ 0, 0 XBROWSE oBrw OF oDlg ARRAY aRecord // AUTOSORT

   oCol = oBrw:AddCol()
   oCol:bStrData = { || Customer->( FieldName( oBrw:nArrayAt ) ) }
   oCol:cHeader = "FieldName"  

   oCol = oBrw:AddCol()
   oCol:bStrData = { || Customer->( FieldGet( oBrw:nArrayAt ) ) }
   oCol:cHeader = "Value"  

   oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW

   oBrw:CreateFromCode()
   oBrw:bKeyCount = { || Customer->( FCount() ) }
   
   oDlg:oClient = oBrw  
     
   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT oDlg:Resize()
     
return nil
 

Image
regards, saludos

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

Re: templates / plantillas

Postby Antonio Linares » Fri Jun 25, 2010 9:33 pm

Nested folders from resources:

test.prg
Code: Select all  Expand view
#include "FiveWin.ch"
 
function Main()
 
   local oDlg, oFld1, oFld2
   
   DEFINE DIALOG oDlg RESOURCE "Test"
 
   REDEFINE FOLDER oFld1 ;
      PROMPTS "One", "Two", "three" ;
      DIALOGS "Another", "Two", "Three" ;
      ID 100 OF oDlg

   REDEFINE FOLDER oFld2 ;
      PROMPTS "One", "Two", "three" ;
      DIALOGS "One", "Two", "Three" ;
      ID 200 OF oFld1:aDialogs[ 1 ]
     
   ACTIVATE DIALOG oDlg CENTERED
 
return nil
 


test.rc
Code: Select all  Expand view
#ifdef __FLAT__
   1 24 "WindowsXP.Manifest"
#endif
 
test DIALOG 17, 36, 185, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
 CONTROL "", 100, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 6, 175, 170
 DEFPUSHBUTTON "OK", 1, 67, 180, 50, 14
}

another DIALOG 6, 15, 175, 117
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
 CONTROL "", 200, "SysTabControl32", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 6, 162, 140
}
 
one DIALOG 6, 15, 175, 117
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
   PUSHBUTTON "Test", 10, 5, 5, 148, 115
}
 
two DIALOG 6, 15, 175, 117
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
}
 
three DIALOG 6, 15, 175, 117
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif"
{
}
 


Image

viewtopic.php?p=100720#p100720
regards, saludos

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

Re: templates / plantillas

Postby Eoeo » Wed Oct 10, 2012 8:53 am

Antonio,

Por error, he descubierto un método para crear diálogo y GEts y se pone fácil como en el viejo clipper dos

Code: Select all  Expand view

#include "fivewin.ch"
#include "constant.ch"

Function test()
Local oDlg
Local aGet[10]
Local cNomeUtente:=space(30),;
        cPassword :=space(30)  ,;
        nTipoAccesso:=space(30)

   Local nBottom   := 22
   Local nRight    := 62
   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   Local nRowPix:=13

DEFINE DIALOG oDlg        ;
   TITLE "test"   ;
   SIZE nWidth, nHeight   PIXEL

   @ 1*nRowPix,02*8 say "Nome      :"      of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 2*nRowPix,02*8 say "Cognome   :"      of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 3*nRowPix,02*8 say "Indirizzo : "     of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 4*nRowPix,02*8 say "Città     :"      of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 5*nRowPix,02*8 say "Provincia :"      of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 6*nRowPix,02*8 say "Cap       : "     of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 7*nRowPix,02*8 say "Telefono  :"      of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 8*nRowPix,02*8 say "Fax       :"      of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT
   @ 9*nRowPix,02*8 say "Cellulare : "     of oDlg update color CLR_BLACK,CLR_WHITE size 80,10 pixel  TRANSPARENT


  @ 1*nRowPix,8*9 GET aGet[1] VAR cNomeUtente  size 100,10 of oDlg update pixel
  @ 2*nRowPix,8*9 GET aGet[2] VAR cPassword    size 100,10 of oDlg update pixel
  @ 3*nRowPix,8*9 GET aGet[3] VAR nTipoAccesso size 100,10 of oDlg update pixel

     @ 11*nRowPix,02*60  BUTTON " &ok" size 80,10 of oDlg pixel action oDlg:end()

 ACTIVATE dialog oDlg center

RETURN  NIL


multiplicando cada línea con 13 para x y 8 para y
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Previous

Return to Utilities / Utilidades

Who is online

Users browsing this forum: No registered users and 3 guests

cron