WebForm in FWH

WebForm in FWH

Postby Vladimir Zorrilla » Thu Jan 28, 2010 6:03 am

Friends

Migrate the forms that we do in FW or with workshop or pure code to forms HTML (WebForm) conserving the design, color, sources, data of the combobox, edition masks and that can be used ENTER instead of TABS.



Example

DEFINE DIALOG oDlg

/// there CONTROLs

ACTIVATE DIALOG oDlg CENTERED ;
ON LEFT CLICK GenWebForm(oDlg,"MIFORMFW")




Func GenWebForm(oForm,filefrm)
Local cHtm:="<html>"+H(),octrl,K:=1,cstyle,i,ctype
htmlhead( @cHtm ,filefrm )
cHtm+="<body>"+h()
cHtm+='<form name="'+filefrm+'" action="'+filefrm+'.php" method="post">'+h()

WHILE K<=len(oForm:aControls) // DISCRIMINAR el resto de las CLASES
//msgalert( oForm:aControls[K]:classname() )
IF oForm:aControls[K]:classname()="TSAY" .or. oForm:aControls[K]:classname()="TGET" .or. oForm:aControls[K]:classname()="TBUTTON" .or. oForm:aControls[K]:classname()="TRADIO" .or. oForm:aControls[K]:classname()="TCHECKBOX" .or. oForm:aControls[K]:classname()="TBITMAP" .or. oForm:aControls[K]:classname()="TIMAGE" .or. oForm:aControls[K]:classname()="TCOMBOBOX"
octrl:=oForm:aControls[K]
cstyle:=' style="width: '+ltrim(str(octrl:nwidth))+'px; height: '+ltrim(str(octrl:nheight))+'px"'
cHtm+='<div class="Estilo1" style="position:absolute; top:'+ltrim(str(octrl:nTop))+'px; left:'+ltrim(str(octrl:nleft))+'px;">'+h()
do case
case octrl:classname()="TSAY"
cHtm+=octrl:cCaption+h()
case octrl:classname()="TGET"
cHtm+='<input '+cstyle+' type="Text" onkeypress="return tabular(event,this)" name="'+qcosaesname(octrl)+'" id="'+ltrim(str(octrl:nId))+'" value="" size="12">'+h()
case octrl:classname()="TCOMBOBOX"
//cHtm+='<SELECT multiple size="4" name="elegir-componente">
cHtm+='<SELECT '+cstyle+' onkeypress="return tabular(event,this)" id="'+ltrim(str(octrl:nId))+'" name="'+qcosaesname(octrl)+'">'+h()
//<OPTION selected value="Componente_1_a">Componente_1</OPTION>
For i=1 to len(octrl:aItems)
cHtm+='<OPTION>'+octrl:aItems[i]+'</OPTION>'+h()
Next i
cHtm+='</SELECT>'+h()
case octrl:classname()="TBUTTON"
ctype="button"
if alltrim(uppe(octrl:cCaption))="GRABAR"; ctype="submit"; endif
if alltrim(uppe(octrl:cCaption))="RESTAURAR"; ctype="reset"; endif
// usar solo apostrofes dentro del blcliked
cHtm+='<BUTTON '+cstyle+' id="'+ltrim(str(octrl:nId))+'" name="'+qcosaesname(octrl)+'" value="'+octrl:cCaption+'" type="'+ctype+'" >'+h()
cHtm+=octrl:cCaption+'</BUTTON>'+h()

case octrl:classname()="TRADIO"
cHtm+='<input '+cstyle+' type="radio" name="'+qcosaesname(octrl)+'" id="'+ltrim(str(octrl:nId))+'" value="'+ltrim(str(octrl:nId))+'" size="12">'+octrl:cCaption+h()

case octrl:classname()="TCHECKBOX"
cHtm+='<input '+cstyle+' type="checkbox" name="'+qcosaesname(octrl)+'" id="'+ltrim(str(octrl:nId))+'" value="" size="12">'+octrl:cCaption+h()

case octrl:classname()="TBITMAP" .OR. octrl:classname()="TIMAGE"
//cHtm+='<IMG '+cstyle+' id="'+ltrim(str(octrl:nId))+'" SRC="'+alltrim(octrl:crutabitmap)+'">'+h()

endcase
cHtm+='</div>'+h()

ENDIF
K++
ENDDO
cHtm+="</body>"+H()
cHtm+="</html>"+H()
FERASE(filefrm+".HTM")
MEMOWRIT(filefrm+".HTM",cHtm)
WAITRUN( "c:\archiv~1\intern~1\iexplore "+filefrm+".HTM")
RETU .T.

Func qcosaesname(octrl)
retu(ltrim(str(octrl:nId)) )


FUNC htmlhead( cHtm,filefrm )
cHtm+="<head>"+H()
cHtm+="<title>"+filefrm+"</title>"+H()
cHtm+='<style type="text/css">'+H()
cHtm+='<!--'+H()
cHtm+='.Estilo1 {'+H()
cHtm+=' font-size: 11px;'+H()
cHtm+=' font-family: Geneva, Arial, Helvetica, sans-serif;'+H()
cHtm+='}'+H()
cHtm+='body {'+H()
cHtm+=' background-color: #E8E8E8;'+H()
cHtm+='}'+H()
cHtm+='-->'+H()
cHtm+='</style>'+H()

cHtm+="<script>"+H()
cHtm+="function tabular(e,obj) {"+H()
cHtm+=" tecla=(document.all) ? e.keyCode : e.which;"+H()
cHtm+=" if(tecla!=13) return;"+H()
cHtm+=" frm=obj.form;"+H()
cHtm+=" for(i=0;i<frm.elements.length;i++)"+H()
cHtm+=" if(frm.elements[i]==obj)"+H()
cHtm+=" {"+H()
cHtm+=" if (i==frm.elements.length-1)"+H()
cHtm+=" i=-1;"+H()
cHtm+=" break"+H()
cHtm+=" }"+H()
/*ACA ESTA EL CAMBIO disabled, Y PARA SALTEAR CAMPOS HIDDEN*/
cHtm+=" if ((frm.elements[i+1].disabled ==true) || (frm.elements[i+1].type=='hidden') )"+H()
cHtm+=" tabular(e,frm.elements[i+1]);"+H()
/*ACA ESTA EL CAMBIO readOnly */
cHtm+=" else if (frm.elements[i+1].readOnly ==true )"+H()
cHtm+=" tabular(e,frm.elements[i+1]);"+H()
cHtm+=" else {"+H()
cHtm+=" frm.elements[i+1].select(); /* AÑADIR LOS CORCHETES Y ESTA INSTRUCCION */"+H()
cHtm+=" frm.elements[i+1].focus();"+H()
cHtm+=" }"+H()
cHtm+=" return false;"+H()
cHtm+="}"+H()
cHtm+=""+H()
cHtm+="</script>"+H()
cHtm+="</head>"+H()
retu .t.

Func h
retu( chr(13)+chr(10))




The labels in the object DOM are drawn in publishers HTML by defect in realtivas positions that is to say, are placed one behind another one and respond to a flow,

This function creates controls FW in labels locked up in layers DIV and establishes fixed absolute positions that agree with the values ntop nleft of this control FW

The data nID of each control FW happens to be YOU GO of each label oara to identify to the control.

Express their ideas of how being able to migrate an application FW to the WEB using JQUERY AJAX y PHP.


Regards
ME INTERESA FW Y XHB POR SER OPEN SOURCE
Vladimir Zorrilla
 
Posts: 225
Joined: Tue Feb 28, 2006 4:25 pm
Location: PERU

Re: WebForm in FWH

Postby Otto » Thu Jan 28, 2010 6:53 pm

Hello Vladimir,
This looks very interesting. Could I use it also with asp and jscript?
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: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: WebForm in FWH

Postby Vladimir Zorrilla » Thu Jan 28, 2010 8:44 pm

Hello

Also it is possible to be used with ASP and Jscript
Remember that all in the end use HTML


Regards
ME INTERESA FW Y XHB POR SER OPEN SOURCE
Vladimir Zorrilla
 
Posts: 225
Joined: Tue Feb 28, 2006 4:25 pm
Location: PERU

Re: WebForm in FWH

Postby Ari » Thu Dec 30, 2010 4:47 pm

Wladimir

Voce tem a WebForm atualizada ? estou tentando fazer algo parecido, aproveitar meu codigo fonte e com poucas modificações poder dispinibilizar hora em FiveWin o Pelo site em HTML

tem como enviar um demo das suas funcoes

Obrigado
Ari

Wladimir

you have the updated WebForm? I'm trying to do something, take my source code and with a few modifications can dispinibilizar At the time Fivewin HTML site

is to send a demo of his duties

Thanks
Ari
Thanks,
Ari

FWH 2212 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br
User avatar
Ari
 
Posts: 236
Joined: Fri Feb 03, 2006 4:21 pm
Location: São Paulo, SP - Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests

cron