Pro's and Contra's fom Resources or Coded screens

Pro's and Contra's fom Resources or Coded screens

Postby Marc Venken » Tue Aug 01, 2017 10:37 pm

What is the general opinion for using Resources or coding screens ?

I see both many times passing in this Forum. Is there a Rule, or just as often, it is the like/dislike of the programmer.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1417
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Pro's and Contra's fom Resources or Coded screens

Postby Carlos Mora » Wed Aug 02, 2017 6:46 am

IMHO, Resources have the advantage of being visually designed. Coding, that is made by hand, requires lots of trial and error. May be with practice you get fluent coding screens, but reading code you are not aware of how the form looks like.
In the other hand, the absolute coordinates systems in which the Windows dialog system is based on doesn't helps to deal with the different screen resolutions out there, it would be better sth like the one used by gtk. I think someone in this forum made some layout controls that mimics the behavior.
My personal option is resources, because it helps somehow to keep certain separation between the presentation layer and the business rules.

My 0,02 € :D

Regards
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Pro's and Contra's fom Resources or Coded screens

Postby Carles » Wed Aug 02, 2017 7:11 am

Hi

Resources of course. Why ? Time and effort. And at the end the results is the same
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1126
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Re: Pro's and Contra's fom Resources or Coded screens

Postby hmpaquito » Wed Aug 02, 2017 7:37 am

Hi,

Coding... of course, but ! a long time I designed relative screen position commands for to help to coding screens:

(R) = RELATIVE

Code: Select all  Expand view

@ RSAY "Customer"
@ RGET oRec:Code

@ RSAY "Name" ;
    SEPARATOR
   
@ RGET oRec:Name

FEED RSAY

@ RSAY "Address"
@ RGET oRec:Address
 


My 2 pixels
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Pro's and Contra's fom Resources or Coded screens

Postby Enrico Maria Giordano » Wed Aug 02, 2017 8:16 am

Marc Venken wrote:What is the general opinion for using Resources or coding screens ?

I see both many times passing in this Forum. Is there a Rule, or just as often, it is the like/dislike of the programmer.


For normal app development resources is far more comfortable. For special tool development (like data driven forms) coding is required. As usual, having both technique available is the best thing for a developer (thank you FWH!).

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

Re: Pro's and Contra's fom Resources or Coded screens

Postby Otto » Wed Aug 02, 2017 4:29 pm

@hmpaquito
Hello,
can you please explain your (R) = RELATIVE.
This looks very interesting to me.

@ others in favour of resources.
How can you resolve the different formfactors and how to program "METRO" style.

Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6301
Joined: Fri Oct 07, 2005 7:07 pm

Re: Pro's and Contra's fom Resources or Coded screens

Postby Silvio.Falconi » Wed Aug 02, 2017 4:45 pm

on win7 many lose of resource and I made only @x,y
I put on res only the bmps

My 0,01 € :shock:
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Pro's and Contra's fom Resources or Coded screens

Postby TimStone » Wed Aug 02, 2017 7:18 pm

I used the @ commands with dBase / Clipper for DOS. However, I never found a way to get consistent results with the @ commands under windows. I would love to use them, but my forms are very filled, and spacing is critical. I use Resources and have everything spaced uniformly. I can specify the exact size, and I use 20 pixel spacing between fields horizontally, and 5 pixel spacing between rows vertically.

I would love to use @ commands, but I have yet to see anything that shows us how to get the spacing correctly. It seems to vary based on the type of control. I need to handle labels, gets, dropdowns, checkboxes, browses, bitmap bars, etc.

Sometimes if I say @ 5,5, then I cannot now use @ 6,5. They overlap. Maybe someone could write a tutorial on how to get these uniform. I'd love it.

With that said, I do have some popups where I can use these, but it is all trial and error. Also, I find that differing controls can vary in height which looks rather poor to the client.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2940
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Pro's and Contra's fom Resources or Coded screens

Postby Armando » Wed Aug 02, 2017 9:44 pm

Marc:

I think, the best way is that you feel more comfortable.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3199
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Pro's and Contra's fom Resources or Coded screens

Postby gkuhnert » Thu Aug 03, 2017 8:52 am

hmpaquito,


are you willing to share your relative screen position commands / technique with us? Like Otto I'm very interested too!
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Pro's and Contra's fom Resources or Coded screens

Postby hmpaquito » Thu Aug 03, 2017 10:03 am

gkuhnert,

My technique about design form with code use extensivity preprocessor for hide design machine.

Cuore is ?

New Commands based in fwh commands.... is a new GUI


Problems ?

At begin was very hard design all commands.


How do it do ?

All is relative positions and sizes. So insert new says or get is very easy.


A piece .ch base:

Code: Select all  Expand view
///////////////////////
// RelativePositions.Ch
//
//
///////////////////////////////////////////
*
#Define PIX_SEPARASAY 80

#Define PWG_ ( oGet:VarGet() )


#Define TMPW_(xNormal, xWord) ;
            xNormal:= If(xNulo_lWord , xNulo_oWord:xWord, xNormal)
#Define TMPW2_(xNormal, xWord) ;
            xNormal:= If(xNulo_lWord .AND. xNulo_oWord:xWord  != NIL, xNulo_oWord:xWord, xNormal)

#xcommand @ [<nRow>] [, <nCol>] ;
            RPSAY <cText> ;
            [<clauses,...>]                     ;
            [ <pict: PICT, PICTURE> <cPict> ] ;
            [ FONT <oFont> ]                    ;
            [ SIZE <nWidth>, <nHeight> ]        ;
            ;
            [ SEPARASAY <lSeparaSay> ];
            [ SUMCOLPIX <nSumColPix> ];
            [ PARRAFO <lParrafo>     ];
            [ ADJUSTLEFT <lAdjustLeft> ] ;
            [ DOBLELINEA <lDobleLinea> ] ;
            [ GETWORD <lGetWord>] ;
            [ MAXWORD    <lMaxWord>            ] ;
            [ CODIGOWIDTH <nCodigoWidth>       ] ;
            [ GETPARRAFO <lGetParrafo>] ;
            [ COLORFORE <nColorFore>] ;
            [ COLORBACK <nColorBack>] ;
            ;
            => ;
            ;
            xNulo_lWord:= .F.;;
            [xNulo_lWord:= <lGetWord>;];
            ;
            xNulo_nCodigoWidth:= NIL;;
            [xNulo_nCodigoWidth:= If(<lMaxWord>, 1, NIL) ;];
            [xNulo_nCodigoWidth:= <nCodigoWidth> ;] ;
            ;
            oCnt:nActualListaWord:= xNulo_nCodigoWidth ;;
            ;
            xNulo_oWord:= If(xNulo_lWord, oCnt:GetWord(), NIL) ;;
            ;
            xNulo_cTextParrafo:= NIL                                        ;;
            [xNulo_cTextParrafo:= If(<lGetParrafo>, oCnt:GetParrafo(), NIL) ;];
            ;
            ;
            ;
            oCnt:xNulo_cText:= <cText>;;
            TMPW_(oCnt:xNulo_cText, cText) ;;
            oCnt:xNulo_cText:= If(xNulo_cTextParrafo != NIL, xNulo_cTextParrafo, oCnt:xNulo_cText) ;;
            ;
            xNulo_cPicture:= NIL;;
            [xNulo_cPicture:= <cPict>;];
            TMPW_(xNulo_cPicture, cPicture);;
            ;
            ;
            xNulo_lDobleLinea:= NIL;;
            [xNulo_lDobleLinea:= <lDobleLinea>;];
            TMPW_(xNulo_lDobleLinea, lDobleLinea);;
            ;
            xNulo_lParrafo   := .f. [.OR. <lParrafo>] [.OR. <lGetParrafo>] ;;
            ;
            xNulo_lAdjustLeft:= .f. [ .OR. <lAdjustLeft>] ;;
            xNulo_lAdjustLeft:= xNulo_lAdjustLeft .OR. (xNulo_lParrafo .AND. !<.lAdjustLeft.>) ;;
            ;
            xNulo_oArea:= oCnt:oArea                                         ;;
            ;
            xNulo_oFont:= If(<.oFont.>, <oFont>, oCnt:CtlSayDefFont(xNulo_lParrafo))         ;;
            TMPW2_(xNulo_oFont, oFont);;
            ;
            xNulo_aSize:= oCnt:CtlSayDefSize(oCnt:xNulo_cText, <cPict>, <nWidth>, <nHeight>, xNulo_oFont, xNulo_lDobleLinea, xNulo_nCodigoWidth)     ;;                       ;;
            TMPW_(xNulo_lDobleLinea, lDobleLinea);;
            xNulo_nRow:=           oCnt:CtlSayRow(<nRow>)                                                              ;;
            xNulo_nRowDobleLinea:= oCnt:CtlSayRowAjuDobleLinea(xNulo_lDobleLinea, xNulo_oWord)                                                              ;;
            ;
            xNulo_nCol:= If(<.nCol.>,  <nCol>,  oCnt:UltRight()) ;;
           [xNulo_nCol+= If(<lSeparaSay>, oCnt:SeparaSay(), 0) ;];
           [xNulo_nCol+= <nSumColPix> ;];
            xNulo_nCol:= If(xNulo_lAdjustLeft, If(xNulo_lParrafo, oCnt:MarginLeftParrafo(), oCnt:MarginLeft()), xNulo_nCol)             ;;
            ;
            oCnt:ToPos(xNulo_nRow, xNulo_nCol+ xNulo_aSize\[1\])                              ;;
            ;
            xNulo_nRow+= xNulo_nRowDobleLinea;;
            ;
            ;
            ;
          @ xNulo_nRow, xNulo_nCol    SAY oCnt:xNulo_cText ;
            [<clauses>]                                     ;
            PICTURE xNulo_cPicture                          ;
            OF xNulo_oArea                                  ;
            FONT xNulo_oFont                                ;
            PIXEL                                           ;
            ;
            ;
            ;
            ;
            COLOR (If(.f. [.OR. <lGetParrafo>], oCnt:nClrParrafoFore, oCnt:nClrSayFore) [, <nColorFore>]), ( xNulo_oArea:nClrPane [, <nColorBack>] );
            SIZE xNulo_aSize\[1\], xNulo_aSize\[2\]         ;
            ;;
            If(xNulo_lParrafo, oCnt:SetPagePanel(), NIL)



#Trans VALFUN_(<oCnt>, [<ValidFunc>], [<PreValidFunc>], [<PostValidFunc>], [<SetSeModificoFunc>], [<lAsignaSeModifico>]) => ;
  {|oGet, lPaso|;
  lPaso:= ThFunValidGet(oGet, <oCnt>, <.ValidFunc.>, <.PreValidFunc.>, <.PostValidFunc.>,;
    {|oGet| nil[, <ValidFunc>]}, {|oGet| nil[, <PreValidFunc>]}, {|oGet, lSeModificoGet| nil[, <PostValidFunc>]}),;
  If(!<.lAsignaSeModifico.> [.OR. <lAsignaSeModifico>], <oCnt>:AsignaSeModifico(oGet), nil),;
                                 ;
                                 ;
  lPaso}

#command @  RPGET <uVar> ;
            [<clauses,...>                        ] ;
            [ <pict: PICT, PICTURE> <cPict>       ] ;
            ;
            ;
            ;
            [ ANCHO <nAncho>                      ] ;
            [ SOLONUMEROS <lSoloNumeros>          ] ;
            [ NAME <cName>                        ] ;
            ;
            ;
            [PREVALID <PreValidFunc>              ] ;
            [VALID <ValidFunc>                    ] ;
            [POSTVALID <PostValidFunc>            ] ;
            [OBLIGATORIO <lObligatorio>           ] ;
            [bOBLIGATORIO <lbObligatorio>         ] ;
            [SETSEMODIFICO <SetSeModificoFunc>    ] ;
            [ASIGNASEMODIFICO <lAsignaSeModifico> ] ;
            [NAMEGET_NOMBRE   <cNameGetNombre>    ] ;
            [ONPOSTSELECCION  <bPostSeleccion>    ] ;
            [OBJVAR           <oObjVar>           ] ;
            [TOAST            <bToast>            ] ;
            => ;
            ;
            xNulo_oGet := NIL;;
            ;
            xNulo_oArea:= oCnt:oArea                 ;;
            xNulo_oFont:= oCnt:CtlGetDefFont()          ;;
            xNulo_aSize:= oCnt:CtlGetDefSize(<uVar>, <cPict>, NIL, NIL, xNulo_oFont, <nAncho>, <lSoloNumeros>)     ;;
            xNulo_nRow:= oCnt:UltTop()              ;;
            ;
            xNulo_nCol:= oCnt:UltRight()                     ;;
            xNulo_nCol+= oCnt:SepSayGet();;
            ;
            ;
            oCnt:ToPos(NIL, xNulo_nCol+ xNulo_aSize\[1\])                              ;;
            ;
            ;
         @ xNulo_nRow, xNulo_nCol GET xNulo_oGet VAR <uVar> ;
            [<clauses>]                                ;
            [ PICTURE <cPict> ] ;
            VALID {|oGet, lRet| lRet:= Eval(VALFUN_(oCnt, <ValidFunc>, <PreValidFunc>, <PostValidFunc>, <SetSeModificoFunc>, <lAsignaSeModifico>), oGet), lRet  };
            OF xNulo_oArea    ;
            COLOR "N*/W" ;
            PIXEL        ;
            NOBORDER ;
            SIZE xNulo_aSize\[1\], xNulo_aSize\[2\] ;
            FONT xNulo_oFont                        ;;
            ;
            [<oObjVar>:= oClone(xNulo_oGet)         ;];
            ;
            xNulo_oGet:cVarName:= DepuraName(<(uVar)>) ;;
            [xNulo_oGet:cVarName:= <cName>          ;];
            If(<.cName.>, oCnt:DefineBtnGet(xNulo_oGet, <cNameGetNombre>, <bPostSeleccion>), NIL);;
            xNulo_oGet:oGet:Cargo:= CargoGetClip() ;;
            xNulo_oGet:oGet:Cargo:xOriginal1:= <uVar> ;;
            xNulo_oGet:oGet:Cargo:xOriginal2:= <uVar> ;;
            [xNulo_oGet:bToast:= <bToast> ]



// Como comando GET con algunos cambios
#command @ [<nRow>] [, <nCol>] RPASOCIADO [ <oGet> VAR ] <uVar> ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ <pict: PICT, PICTURE> <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <pass: PASSWORD> ] ;
            [ <lNoBorder: NO BORDER, NOBORDER> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ ACTION <uAction> ] ;
            [ BITMAP <cBmpName> ] ;
            [ CUEBANNER <cCueText> ] ;
            ;
            ;
            ;
            [ ANCHO <nAncho>                      ] ;
            [ SOLONUMEROS <lSoloNumeros>          ] ;
            [ ASOCIADOINTENSO  <lAsociadoIntenso>             ] ;
            [ ASOCIADOINTENSO2 <lAsociadoIntenso2>            ] ;
       => ;
            ;
            xNulo_oArea:= oCnt:oArea                 ;;
            xNulo_oFont:= oCnt:CtlGetDefFont()          ;;
            xNulo_aSize:= oCnt:CtlGetDefSize(<uVar>, <cPict>, NIL, NIL, xNulo_oFont, <nAncho>, <lSoloNumeros>)     ;;
            xNulo_nRow:= oCnt:UltTop()              ;;
            ;
            xNulo_nCol:= oCnt:UltRight()                     ;;
            xNulo_nCol+= oCnt:SepSayGet();;
            ;
            oCnt:ToPos(NIL, xNulo_nCol+ xNulo_aSize\[1\])                              ;;
            ;
            ;
            xNulo_lReadOnly:= .t.;;
            xNulo_lNoBorder:= (.T.             [,     !<lAsociadoIntenso> ] );;
            xNulo_lNoBorder:= (xNulo_lNoBorder [.AND. !<lAsociadoIntenso2>] );;
            ;
            ;
            ;
            xNulo_oGet:=  TGet():New( xNulo_nRow, xNulo_nCol, <{uVar}>,;
             xNulo_oArea, xNulo_aSize\[1\], xNulo_aSize\[2\], <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, xNulo_oFont, <.design.>,;
             <oCursor>, .t., <cMsg>, <.update.>, \{|| .f. \},;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], xNulo_lReadOnly,;
             <.pass.>, xNulo_lNoBorder, <nHelpId>,,,,,, [\{|self| <uAction> \}],;
             <cBmpName>, [<(oGet)>], [<cCueText>],;
             nil, nil, nil,;
         .t., <lAsociadoIntenso>, <lAsociadoIntenso2> );;
             ;
             [<oGet>:= xNulo_oGet;];
             oCnt:AddCtlAsociado(xNulo_oGet)
 




A small sample:

Code: Select all  Expand view
//-------------------------------------------------------------------------//
FUNCTION ControlDesign(oCnt)

SET VSEPARATION TO 10  // Vertical Separation by default
SET HSEPARATION TO 8   // Horizontal Separation inter Says

@ 2, 1 RPSAY "Customer"
@ PWTGET oPid:oVar:cCli;
  POSTVALID oPid:EnableDisableBtnOkCancel() ;
  NAME "CUSTOMER_CODE" ;
  ONPOSTSELECCION {|oGet| oPid:EnableDisableBtnOkCancel()}
@ RPASOCIADO BUS2_CLIENT(oPid:oVar:cCli, NomCli)


oCnt:FeedSay()
@ RPSAY "Name";
  GETWORD .T.;
  ADJUSTLEFT .T. ;
  MAXWORD .T.
@ RPGET oRec:NameCli;
  PICTURE "@S35" ;
  NAME "NameCli"

oCnt:Activate()

RETURN NIL
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Pro's and Contra's fom Resources or Coded screens

Postby gkuhnert » Fri Aug 04, 2017 9:09 am

hmpaquito,
thank you very much. I will try, see and learn :-)
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Pro's and Contra's fom Resources or Coded screens

Postby Antonio Linares » Fri Aug 04, 2017 9:57 am

You can easily use relative coordinates this way:

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

function Main()

   local nRow := ScreenHeight() / 80
   local nCol := ScreenWidth() / 120
   local oDlg, cName := Space( 10 ), cAddress := Space( 15 )

   DEFINE DIALOG oDlg SIZE nCol * 30, nRow * 20
   
   @ nRow * 1.2, nCol * 2 SAY "Name:" OF oDlg PIXEL

   @ nRow * 1, nCol * 5 GET cName OF oDlg PIXEL

   @ nRow * 3.2, nCol * 2 SAY "Address:" OF oDlg PIXEL

   @ nRow * 3, nCol * 5 GET cAddress OF oDlg PIXEL

   ACTIVATE DIALOG oDlg CENTERED

return nil
regards, saludos

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

Re: Pro's and Contra's fom Resources or Coded screens

Postby Marc Venken » Fri Aug 04, 2017 2:13 pm

Use both systems will be best. In my 16 bit version I use these from recources : (preparing conversion to FWH)

Image

Image

But as Otto asked, These cannot by resized on the fly?

If I want to pimp design (More color and so) that is not done in (Pelles), but with code changing the object as far as I see code ?

Larger screens will be Recources
Little = coding.

Thanks for all replies.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1417
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Pro's and Contra's fom Resources or Coded screens

Postby Carles » Fri Aug 04, 2017 4:01 pm

Marc,

Larger screens = Resources
Little = Resources

Believe me :wink:

C.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1126
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 23 guests