topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
|---|---|
Amigos expertos en MySql + xHarbour
|
Francisco
Buenos dias
En la sintaxis tienes este error :
tu escribes AUTO INCREMENT
debe ser AUTO_INCREMENT
SALUDOS
|
Amigos expertos en MySql + xHarbour
|
Ricardo:
¡Magnifico! ¡Excelente!...!Al fin funciona!. Estaba a punto de "colgar los guantes". En lo futuro, voy a ser más cuidadoso para no "trabarme". Lo raro es que no presenta ningún mensaje de error por mala sintaxis. Sólo no creaba la tabla.
Muchas gracias a tí, y a cada uno de ustedes.
Saludos.
|
Amigos expertos en MySql + xHarbour
|
[quote="FranciscoA":2cifngpb]Ricardo:
¡Magnifico! ¡Excelente!...!Al fin funciona!. Estaba a punto de "colgar los guantes". En lo futuro, voy a ser más cuidadoso para no "trabarme". Lo raro es que no presenta ningún mensaje de error por mala sintaxis. Sólo no creaba la tabla.
Muchas gracias.
Saludos.[/quote:2cifngpb]
FranciscoA,
De hecho si envía un mensaje, solo que regresa una consulta. en esa consulta va el error.
saludos
|
Amigos expertos en MySql + xHarbour
|
Entendido, William. Muchisimas gracias.
Saludos.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Amigos,
Como se de la familia que hemos formado (a la distancia), me es triste comentarles del fallecimiento de un amigo/hermano del foro RAMON PAREDES.
Pido acompañemos a la familia en estos momentos tan difíciles.
Los que conocimos a Ramón sabemos de la gran persona que era.
[url=http://imageshack.us/photo/my-images/821/ramoncopy2.jpg/:30wh0amz][img:30wh0amz]http://img821.imageshack.us/img821/2900/ramoncopy2.jpg[/img:30wh0amz][/url:30wh0amz]
Uploaded with [url=http://imageshack.us:30wh0amz]ImageShack.us[/url:30wh0amz]
|
Amigos no me gusta ser portador de tan triste noticia...
|
sin palabras.
acompañemos, a la familia en este dificil momento.
Descance en paz Ramon.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Me quede helado y sin palabras..
Que triste noticia saber que se nos estan adelantando, Descanse en Paz. <!-- s:cry: --><img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very sad" /><!-- s:cry: --> <!-- s:cry: --><img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very sad" /><!-- s:cry: -->
|
Amigos no me gusta ser portador de tan triste noticia...
|
Triste noticia. Mi sentido pésame a la familia.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi Sentido Pesame a Toda Su Familia
Triste PEro Asi Es La Vida
Carlos I. De La Rosa
|
Amigos no me gusta ser portador de tan triste noticia...
|
Me dolio esta triste noticia <!-- s:cry: --><img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very sad" /><!-- s:cry: -->
Ramon fue muy atento y paciente ayudándome
Ramon te extrañaremos [img:393rd22n]http://forums.fivetechsupport.com/download/file.php?avatar=935_1282849879.jpg[/img:393rd22n] descansa en paz
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi mas sentido pesame a la familia.
Descanse en paz.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Descanse en paz!
|
Amigos no me gusta ser portador de tan triste noticia...
|
Un fuerte abrazo a su familia. Una pena enorme.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Tuve la oportunidad de tener algunos contactos con este colega, y me alcanzó para comprobar su maravillosa forma de ser y su sencibilidad.
Mi más sentido pésame a la familia, descansa en paz amigo. <!-- s:( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!-- s:( -->
|
Amigos no me gusta ser portador de tan triste noticia...
|
Realmente que triste noticia.
Mis mas sentidos pésame a todos sus allegados.
Descanza en PAZ querido Ramón, extrañaremos tus valiosos aporte al FORO.
Adhemar
|
Amigos no me gusta ser portador de tan triste noticia...
|
QEPD Ramón,
Mi muy sentido pésame a su familia y seres queridos...
|
Amigos no me gusta ser portador de tan triste noticia...
|
que triste noticia.
QEPD Ramón,
Mi muy sentido pésame a su familia y seres queridos
|
Amigos no me gusta ser portador de tan triste noticia...
|
Que en paz Descanse, y mucha resignación por la perdida para
la familia.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Ramón te adelantaste, un día estaremos contigo.
Mi apoyo y solidaridad a la familia.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi mas sentido pésame a su familia y pronta resignación.. algún dia por alla nos veremos...
R.I.P.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi mas sentido pesame a la famila,
Descanza en Paz Ramon.
|
Amigos no me gusta ser portador de tan triste noticia...
|
El mas sentido pesame a su familia.
Descanse en paz!
|
Amigos no me gusta ser portador de tan triste noticia...
|
Amigo Ramón, que Dios esté contigo en este nuevo viaje.
Una abrazo y mucha fortaleza a su familia.
Carlos Gallego
|
Amigos no me gusta ser portador de tan triste noticia...
|
Que el señor todo poderoso te acoga en su santo seno.. Amén.
Descansa en Paz Hermano
|
Amigos no me gusta ser portador de tan triste noticia...
|
Descansa en Paz compañero,,,
Willi Quintana
|
Amigos no me gusta ser portador de tan triste noticia...
|
Siempre se van los mejores.
Un fuerte abrazo, amigo, descansa en paz.
Ricardo Blanco.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Amigos del foro, comparto con ustedes el sentimiento de dolor que causa la partida de una amigo, un colega, un ser querido, y extiendo a sus familiares este sentir de dolor y les exhorto a reflexionas en que la muerte pude ser un nuevo nacer "Juan 11:25 ->[color=#0000BF:doipe62t][b:doipe62t]Le dijo Jesús: Yo soy la resurrección y la vida; el que cree en mí, aunque esté muerto, vivirá.[/color:doipe62t][/b:doipe62t] Hermosa reflexión para quienes tienen definido su condición espiritual.
El Señor Bendiga a todos los integrantes de este foro cuando sus sentimientos son los de construir
cordialmente
Jairo
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mis sentido pésame a la familia. Que descanse en paz.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Teníamos pendiente con él y Carlos Vargas, una reunión de Fivewiners y fortalecer lazos de Amistad. Pude hablar con él, pero no se concretó la reunión.
Mi sentido pésame por la familia, que Dios le guarde y le tenga en su presencia.
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi mas sentido pesame a su familia.
Saludos desde Brasil
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi mas sentido pesame a su familia
Paz en su tumba
Un abrazo desde Quito Ecuador
|
Amigos no me gusta ser portador de tan triste noticia...
|
Mi sentido pesame y condolencias a su familia y amigos
Desde Chile
Adolfo
|
Amigos no me gusta ser portador de tan triste noticia...
|
Que dios le tenga en la gloria....
mis mas sentido sentimiento de pesar por la perdida de un amigo.
|
Amigos: Seria posible BackUp con Harbour.
|
Amigos:
Alguien tiene ya alguna utilidad de BackUp hecha en Harbour ?
O alguien conoce algun a utilidad (desde linea de comandos)
para usar con Harbour. ?
Muchas gracias.
Ruben Fernandez.
|
Amigos: Seria posible BackUp con Harbour.
|
Utiliza la opcion buscar del foro para la palabra "hbzip". Eso de mostrará todos los temas referidos a copias de seguridad que se han transmitido. En alguno de ellos vas a encontrar incluso los codigos para hacer copias de seguridad... con xHarbour (harbour estaba limitado para hacer copias de seguridad, antes, no se si seguira hasta la fecha)
|
Amigos: Seria posible BackUp con Harbour.
|
Rubén:
Mira en <!-- w --><a class="postlink" href="http://www.backupbuilder.com">www.backupbuilder.com</a><!-- w -->.
Ahí el buen amigo Timm ha dejado una herramienta
que puedes usar desde tu app o desde la linea de comandos
Ahhhh y es gratuita.
Saludos
|
Amigos: Seria posible BackUp con Harbour.
|
Gracias a los dos Armando.
Saludos.
Ruben Fernandez.
|
Ammyy : A free remote control software. No IP forward req.
|
<!-- m --><a class="postlink" href="http://www.ammyy.com/en/">http://www.ammyy.com/en/</a><!-- m -->
[b:13tmna3i]Things attracted me [/b:13tmna3i]
1) It is a free remote control software
2) A replacement for expensive TeamViewer ( Non commercial use is free in TeamViewer)
3) Similiar to TeamViewer, ie No need for Real IP and IP forwarding. No installtion required. Just run the exe
4) Very small in size. Only 144KB
5) I Found Ammyy a bit slow compared to TeamViewer. May be due to the high Internet traffic on my network while I tested
It has 2 modes Public Router mode (Like TeamViewer) and a Private router mode. I tested both and working fine
[b:13tmna3i]As per the site[/b:13tmna3i]
Ammyy Admin is a highly reliable and very friendly tool for remote computer access. You can provide remote assistance, remote administration or remote teaching for your clients, employees and friends regardless of their location. Ammyy Admin connects remote computers within seconds without any installation or configuration. You can view and/or control (using your keyboard and mouse) any applications running on the remote computers.
Regards
Anser
|
Ammyy : A free remote control software. No IP forward req.
|
I tried setting up a Private Router and connected PC's in different geographical areas. I found that the performance is much better than using the public router.
The speed and performance is really good.
Regards
Anser
|
Ammyy : A free remote control software. No IP forward req.
|
Anser,
there are two files at the ammyy website, admin.exe and router.exe.
I want to do remote support for a friend im the same city.
Could you please tell me which of these programs are needed and how to set up them?
Many thanks for your tips.
Regards,
Detlef
|
Ammyy : A free remote control software. No IP forward req.
|
Dear Mr.Detlef Hoefner,
[quote:2i49jmyt]Could you please tell me which of these programs are needed ?[/quote:2i49jmyt]
If you are goint to use a Public router (Supported by AMMYY )then you need only [color=#0000FF:2i49jmyt]AMMYY_Admin.exe[/color:2i49jmyt]
[color=#0000FF:2i49jmyt]AMMYY_Router.exe[/color:2i49jmyt] is to be used only if you are going to have your own Private router setup.
For the time being it is better to use the Public router (AMMYY_Admin.exe). And once you get familiar and need more performance you may use your Private Router (AMMYY_Router.exe )
[quote:2i49jmyt]How to set up them?[/quote:2i49jmyt]
[b:2i49jmyt][color=#FF0000:2i49jmyt]Assuming that you are trying to access your freinds desktop thru Ammyy[/color:2i49jmyt][/b:2i49jmyt]
[b:2i49jmyt][color=#0040FF:2i49jmyt][u:2i49jmyt]In your PC do the following[/u:2i49jmyt][/color:2i49jmyt][/b:2i49jmyt]
[b:2i49jmyt]1)[/b:2i49jmyt] Run AMMYY_Admin.exe
[b:2i49jmyt]2)[/b:2i49jmyt] Please take note of the[color=#0000FF:2i49jmyt] ID [/color:2i49jmyt]shown in the Text Box. This is required
[b:2i49jmyt]2)[/b:2i49jmyt] Goto the Menu[color=#0000FF:2i49jmyt] AMMYY[/color:2i49jmyt] -> [color=#0000FF:2i49jmyt]Settings[/color:2i49jmyt]
[b:2i49jmyt]3)[/b:2i49jmyt] On the Ammyy settings dialog, On the [color=#0000FF:2i49jmyt]Routers[/color:2i49jmyt] Group choose [color=#0000FF:2i49jmyt]Public[/color:2i49jmyt] and press [color=#0000FF:2i49jmyt]OK button[/color:2i49jmyt]. That's all at your end
[b:2i49jmyt][color=#0040FF:2i49jmyt][u:2i49jmyt]At your freinds PC[/u:2i49jmyt][/color:2i49jmyt][/b:2i49jmyt]
[b:2i49jmyt]1)[/b:2i49jmyt] Ask your friend to do the above given steps in his PC
[b:2i49jmyt]2) [/b:2i49jmyt]Ask him to let you know the [color=#0000FF:2i49jmyt]ID[/color:2i49jmyt] shown in his Ammyy Admin screen. (This can be automated later)
[b:2i49jmyt]3) [/b:2i49jmyt]Ask him to click on the [color=#0000FF:2i49jmyt]Start button[/color:2i49jmyt] available in the [color=#0000FF:2i49jmyt]Tab Client[/color:2i49jmyt]
[b:2i49jmyt][color=#0040FF:2i49jmyt][u:2i49jmyt]Now at your PC[/u:2i49jmyt][/color:2i49jmyt][/b:2i49jmyt]
[b:2i49jmyt]1)[/b:2i49jmyt] Choose the [color=#0000FF:2i49jmyt]Operator Tab[/color:2i49jmyt]
[b:2i49jmyt]2)[/b:2i49jmyt] Type the Client ID and click the [color=#0000FF:2i49jmyt]Connect button[/color:2i49jmyt]. That's all
Once you click [color=#0000FF:2i49jmyt]Connect Button[/color:2i49jmyt], you friends PC will ask whether to allow you, he has to approve it. (This part can be automated, so that in future it can be connected without any user intervention. The Ammyy can be run as a service also)
This can be used to support you clients without any software licencing cost
[u:2i49jmyt]I have found that using a Private Router gives much more performance[/u:2i49jmyt]
I believe that by default the setting is to use Public Router, which means you don't have to do anything.
[b:2i49jmyt]1)[/b:2i49jmyt] Ask your friend to Run [color=#0000FF:2i49jmyt]AMMYY_Admin.Exe[/color:2i49jmyt]
[b:2i49jmyt]2)[/b:2i49jmyt] Ask your friend to let you know his [color=#0000FF:2i49jmyt]ID[/color:2i49jmyt]
[b:2i49jmyt]3)[/b:2i49jmyt] Ask your friend to Click on the[color=#0000FF:2i49jmyt] Start Button[/color:2i49jmyt] in the [color=#0000FF:2i49jmyt]Client Tab[/color:2i49jmyt]. That's all
[b:2i49jmyt]4)[/b:2i49jmyt] In your PC you run [color=#0000FF:2i49jmyt]AMMYY_Admin.Exe[/color:2i49jmyt]
[b:2i49jmyt]5)[/b:2i49jmyt] Type your Friend's [color=#0000FF:2i49jmyt]ID[/color:2i49jmyt] and Click on the [color=#0000FF:2i49jmyt]Connect Button[/color:2i49jmyt] on the [color=#0000FF:2i49jmyt]Operator Tab[/color:2i49jmyt]
Hope it is clear to you.
Regards
Anser
|
Ammyy : A free remote control software. No IP forward req.
|
Anser,
What's involved in setting up a private router? Could you elaborate?
Thanks. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
|
Ammyy : A free remote control software. No IP forward req.
|
Dear Mr.Harvey,
[quote:1vq8v5v3]What's involved in setting up a private router? Could you elaborate? [/quote:1vq8v5v3]
By default Ammyy will be using thier router setup (Public Router, Similiar to Teamviewer) which is easy to setup. We can have our own Router setup, which is more efficient (according to me).
Private router is nothing different. You need to have a Static IP at the location where u r planning to run the Private router. In one of your servers/PC the Ammyy_router.exe will be running and all your clients will use Private router with your router's Static IP. You should also designate a port to be used by the router. On your router (which does the NAT) you should forward all incoming (Ammyy router port) traffic to the PC running the Ammyy_Router.Exe
I feel it is more secure and there is considerable performance difference.
Regards
Anser
|
Ammyy : A free remote control software. No IP forward req.
|
Thanks Anser. I think I more or less get the picture now.
|
Ammyy : A free remote control software. No IP forward req.
|
Yes, Ammyy Admin is a good remote desktop software. Alternatively, you may have a look at on premise R-HUB remote support servers for remotely controlling computers from anywhere anytime. It is easy to use and works well.
|
Amount of users on network
|
Hi,
Is there a way to see how many users open a FWH program on a network.
I know I can make a counter in a database that increase everytime that program is executed, en decrease while exiting.
The problem there can be that when the program crash, or when the network-connection is broken, the counter is wrong.
|
Amount of users on network
|
Hi, please try this:
The UserLogging function creates the txt file for user control when it enters the program and deletes it when it exits.
To view all connected users, you can use the ShowConectedUsers function.
( Idea tomada de un usuario aqui en el foro: hmpaquito)
<!-- l --><a class="postlink-local" href="http://fivetechsupport.com/forums/viewtopic.php?f=6&t=16001&hilit=usuarios+conectados&sid=445b23062ba78d3030099d8213c107bf#p82909">viewtopic.php?f=6&t=16001&hilit=usuarios+conectados&sid=445b23062ba78d3030099d8213c107bf#p82909</a><!-- l -->
[code=fw:3vqi21xx]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">//----------------------------------------------------------------</span><br /><span style="color: #B900B9;">//USUARIOS CONECTADOS -- Francisco J. Alegria P. Sept/2010</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------</span><br /><span style="color: #B900B9;">//---------------------------------------------------------------//Ctrl usuarios activos en este programa</span><br /><span style="color: #00C800;">Function</span> UserLogging<span style="color: #000000;">(</span>lNew<span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> cDirUserLog := cPathDef+<span style="color: #ff0000;">"<span style="color: #000000;">\U</span>SERSLOG"</span><br /><span style="color: #00C800;">local</span> cUserLog<br /><span style="color: #00C800;">local</span> cEquipo:=NetName<span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">local</span> nHand, FO_SHARED := <span style="color: #000000;">64</span><br /><br /><span style="color: #00C800;">If</span> !lIsDir<span style="color: #000000;">(</span>cDirUserLog<span style="color: #000000;">)</span> <span style="color: #B900B9;">//creamos el sub-dir</span><br /> lMkDir<span style="color: #000000;">(</span>cDirUserLog<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #B900B9;">//cNombUser es static, y se toma del fich de usuarios</span><br />cUserLog := cDirUserLog+<span style="color: #ff0000;">"<span style="color: #000000;">\"</span>+Substr(cNombUser,1,12)+cEquipo+"</span>.log<span style="color: #ff0000;">"<br /><br />If lNew //Entrando<br /> nHand := FCreate( cUserLog )<br /><br /> FWrite(nHand, cNombUser + CRLF+; //usuario del programa<br /> cEquipo + CRLF+"</span><span style="color: #ff0000;">") //nombre del equipo<br /> FClose(nHand)<br /><br /> //Lo abrimos en modo shared. (nHandUserLog es static)<br /> //Cuando se requiere ver los conectados al programa, se trata de abrir en exclusivo,<br /> //y si no se puede, es que el usuario esta conectado al programa. (Ver ShowConnectedUsers())<br /> nHandUserLog := FOpen( cUserLog, FO_SHARED ) // abrimos el fichero compartido<br /><br />Else //Saliendo<br /> FClose(nHandUserLog)<br /> Ferase(cUserLog)<br />Endif<br /><br />Return nil<br /><br />/* --------------------------------------------------------------------<br />//Fileio.ch<br />OPEN MODES: <br />FO_READ 0 Open file for reading <br />FO_WRITE 1 Open file for writing<br />FO_READWRITE 2 Open file for reading and writing<br /><br />SHARING MODES:<br />FO_COMPAT 0 Compatibility mode<br />FO_EXCLUSIVE 16 Exclusive use<br />FO_DENYWRITE 32 Prevent other applications from writing<br />FO_DENYREAD 48 Prevent other applications from reading<br />FO_DENYNONE 64 Allow others to read or write<br />FO_SHARED 64 Same as FO_DENYNONE<br /> -------------------------------------------------------------------- */<br /><br />//----------------------//Mostrar usuarios activos en este programa<br />Function ShowConnectedUsers()<br />local cDirUserLog := cPathDef+"</span>\USERSLOG<span style="color: #ff0000;">"<br />local aDir := DIRECTORY(cDirUserLog + "</span>\*.*<span style="color: #ff0000;">", )<br />local nHand, aActiveUsers:={}, cLogText, cFich<br />local cUserName,cComputName<br />local FO_EXCLUSIVE:=16<br /><br />AEVAL( aDir, {|aFich| cFich:=cDirUserLog+"</span>\<span style="color: #ff0000;">"+aFich[F_NAME],;<br /> if( nHand := FOpen( cFich, FO_EXCLUSIVE ) < 0,; //si no se abre exclusivo es que usuario esta conectado.<br /> ( cLogText := MemoRead(cFich),;<br /> cUserName := Trim(MemoLine(cLogText, 254,1)),;<br /> cComputName := Trim(MemoLine(cLogText, 254,2)),;<br /> aadd( aActiveUsers, {cUserName,cComputName} ) ),;<br /> FClose(nHand) ) } )<br /><br />XBrowse(aActiveUsers,"</span>Usuarios conectados a <span style="color: #ff0000;">"+cExeName)<br />Return nil<br /></span></div>[/code:3vqi21xx]
Regards.
|
Amount of users on network
|
Francisco,
Thank you for the reply.
Now I have already something like that, but instead of saving it to a file, I save it in the database.
The problem is that when the program is started, it save it to the database, but when the connecting is lost, without exiting the program first, or if the program crashed, the data is still in the database.
So, the other users think that the user is still in the program.
The only way that I can remove it by starting the program again from the same PC/USER.
|
Amount of users on network
|
Hello Marc,
I don't sure, but I think one way can be to lock a record in a table (dbf) users while the user is logged, when the user logout, unlock the record, I think (no sure) when client lost the conection, the record is unlocked automatlicaly, you can test
saludos
Marcelo
|
Amount to words
|
If you need to convert amount to words, I have a nice code ready for this purpose.
Example: Net Amount: 2500.00
In Words: Two Thousand Five Hundred Only
Please inform if anyone require this.
|
Amount to words
|
[url:1w2j3mjn]http://forums.fivetechsupport.com/viewtopic.php?f=6&t=25450&p=138694&hilit=convertir+numeros+a+letras#p138694[/url:1w2j3mjn]
|
Amount to words
|
*-------------------------------------------------------------------------------*
function fig2wrd( nNum, cCurr, cPaise )
local cNum := i2c( nNum ), cRet := '', cDec := ''
cCurr := iif( cCurr = NIL, 'Rupees', cCurr ) + ' '
cPaise := iif( cPaise = NIL, 'Paise' , cPaise ) + ' '
if '.' $ cNum
cDec := substr( cNum, at( '.', cNum ) + 1 )
endif
nNum := int( nNum )
if nNum > 0
cRet := cCurr
endif
cRet += wrd_Crores( nNum )
if .not. empty( cDec )
cRet := alltrim( cRet )
cRet += ' And ' + cPaise
cRet += wrd_Tens( padr( cDec, 2 ) )
endif
if .not. empty( cRet )
cRet := alltrim( cRet )
cRet += ' Only'
endif
return( cRet )
*-------------------------------------------------------------------------------*
static Function wrd_Unit( nNum, cPost )
local cRet := ''
nNum := iif( valtype( nNum ) = 'C', val( nNum ), nNum )
cPost := iif( cPost = NIL, '', cPost )
do case
case nNum = 1; cRet := 'One'
case nNum = 2; cRet := 'Two'
case nNum = 3; cRet := 'Three'
case nNum = 4; cRet := 'Four'
case nNum = 5; cRet := 'Five'
case nNum = 6; cRet := 'Six'
case nNum = 7; cRet := 'Seven'
case nNum = 8; cRet := 'Eight'
case nNum = 9; cRet := 'Nine'
endcase
return( cRet + iif( empty( cRet ), '', cPost ) )
*-------------------------------------------------------------------------------*
static Function wrd_Tens( nNum, cPost )
local cRet := '', cNum
nNum := iif( valtype( nNum ) = 'C', val( nNum ), nNum )
cPost := iif( cPost = NIL, '', cPost )
do case
case nNum = 10; cRet := 'Ten'
case nNum = 11; cRet := 'Eleven'
case nNum = 12; cRet := 'Twelve'
case nNum = 13; cRet := 'Thirteen'
case nNum = 14; cRet := 'Fourteen'
case nNum = 15; cRet := 'Fifteen'
case nNum = 16; cRet := 'Sixteen'
case nNum = 17; cRet := 'Seventeen'
case nNum = 18; cRet := 'Eighteen'
case nNum = 19; cRet := 'Nineteen'
otherwise
if nNum >= 90; cRet := 'Ninety '
elseif nNum >= 80; cRet := 'Eighty '
elseif nNum >= 70; cRet := 'Seventy '
elseif nNum >= 60; cRet := 'Sixty '
elseif nNum >= 50; cRet := 'Fifty '
elseif nNum >= 40; cRet := 'Forty '
elseif nNum >= 30; cRet := 'Thirty '
elseif nNum >= 20; cRet := 'Twenty '
endif
endcase
if nNum < 10 .or. nNum > 20
cNum := i2c( nNum )
cRet += wrd_Unit( substr( cNum, -1 ) )
endif
return( cRet + iif( empty( cRet ), '', cPost ) )
*-------------------------------------------------------------------------------*
static Function wrd_Hundreds( nNum, cPost )
local cRet := '', cNum
nNum := iif( valtype( nNum ) = 'C', val( nNum ), nNum )
cNum := i2c( nNum )
cPost := iif( cPost = NIL, '', cPost )
if nNum > 99
cNum := substr( cNum, -3, 1 )
cRet := wrd_Unit( cNum, ' Hundred ' )
endif
cNum := i2c( nNum )
cRet += wrd_Tens( substr( cNum, -2 ) )
return( cRet + iif( empty( cRet ), '', cPost ) )
*-------------------------------------------------------------------------------*
static Function wrd_Thousands( nNum )
local cRet := '', cNum, nPos := 0, nChar
cNum := i2c( nNum )
if len( cNum ) >= 5
nPos := 4
nChar := 2
elseif len( cNum ) >= 4
nPos := 3
nChar := 1
endif
if nPos > 0
cNum := substr( cNum, len( cNum ) - nPos, nChar )
cRet := wrd_Tens( cNum, ' Thousand ' )
endif
cNum := i2c( nNum )
cRet += wrd_Hundreds( substr( cNum, -3 ) )
return( cRet )
*-------------------------------------------------------------------------------*
static Function wrd_Lakhs( nNum )
local cRet := '', cNum, nPos := 0, nChar
cNum := i2c( nNum )
if len( cNum ) >= 7
nPos := 6
nChar := 2
elseif len( cNum ) >= 6
nPos := 5
nChar := 1
endif
if nPos > 0
cNum := substr( cNum, len( cNum ) - nPos, nChar )
cRet := wrd_Tens( cNum, ' Lakh ' )
endif
cNum := i2c( nNum )
cRet += wrd_Thousands( substr( cNum, -5 ) )
return( cRet )
*-------------------------------------------------------------------------------*
static Function wrd_Crores( nNum )
local cRet := '', cNum, nPos := 0, nChar
cNum := i2c( nNum )
if len( cNum ) >= 10
nPos := 9
nChar := 3
elseif len( cNum ) >= 9
nPos := 8
nChar := 2
elseif len( cNum ) >= 8
nPos := 7
nChar := 1
endif
if nPos > 0
cNum := substr( cNum, len( cNum ) - nPos, nChar )
if nChar <= 2
cRet := wrd_Tens( cNum, ' Crore ' )
else
cRet := wrd_Hundreds( cNum, ' Crore ' )
endif
endif
cNum := i2c( nNum )
cRet += wrd_Lakhs( substr( cNum, -7 ) )
return( cRet )
*-------------------------------------------------------------------------------*
*-------------------------------------------------------------------------------*
|
Amount to words
|
1. Crores and Lakhs are used in India only.
It would be better if you can modify the function to millions for international use and post here.
2. Where is the function I2C(n) ?
|
Amount to words
|
An interesting TIP for Oracle users when they need to spell a number in words in PL/SQL procedure/function or in an SQL statement.
TO_CHAR( TO_DATE( <number>, 'J' ), 'JSP ) -> number in words
|
Ampliar Imagen por zona de seleccion
|
Hola a todos:
Tengo un dialogo donde muestro una imagen y unos botones de ampliar y reducir la imagen, hast aqui bien, pero:
Como puedo hacer que seleccionando con el raton una parte de la imagen se me amplie ese trozo unicamente? es como funcionan los programas de diseño. Estoy usando la clase TImage.
Muchas gracias de antemano.
JLL
|
Ampliar Imagen por zona de seleccion
|
Saludos
te dejo un simple ejemplo
[code=fw:33b3y62k]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Image.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oDlg, oImage<br /> <span style="color: #00C800;">LOCAL</span> gcFile<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> <span style="color: #000000;">22</span>, <span style="color: #000000;">60</span> ;<br /> <span style="color: #0000ff;">TITLE</span> FWDESCRIPTION + <span style="color: #ff0000;">" JPG,JIF,GIF,BMP,DIB,RLE,TGA,PCX support!"</span><br /><br /> @ <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span> <span style="color: #0000ff;">IMAGE</span> oImage <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">150</span>, <span style="color: #000000;">150</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">SCROLL</span> <span style="color: #0000ff;">ADJUST</span><br /><br /> ZoomZone<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> oImage <span style="color: #000000;">)</span><br /> <br /> oImage:<span style="color: #0000ff;">Progress</span><span style="color: #000000;">(</span> .f. <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">1</span>, <span style="color: #000000;">28</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Select Image"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> gcFile := GetImage<span style="color: #000000;">(</span> oImage <span style="color: #000000;">)</span><br /><br /> @ <span style="color: #000000;">2</span>, <span style="color: #000000;">28</span> <span style="color: #0000ff;">BUTTON</span> <span style="color: #ff0000;">"Reload"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">50</span>,<span style="color: #000000;">10</span> <span style="color: #0000ff;">OF</span> oDlg <span style="color: #0000ff;">ACTION</span> <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> gcFile != <span style="color: #00C800;">NIL</span>, oImage:<span style="color: #000000;">LoadBmp</span><span style="color: #000000;">(</span> gcFile <span style="color: #000000;">)</span>, <span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTER</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> GetImage<span style="color: #000000;">(</span> oImage <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> gcFile := cGetFile<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Bitmap (*.bmp)| *.bmp|"</span> + ;<br /> <span style="color: #ff0000;">"DIB (*.dib)| *.dib|"</span> + ;<br /> <span style="color: #ff0000;">"PCX (*.pcx)| *.pcx|"</span> + ;<br /> <span style="color: #ff0000;">"JPEG (*.jpg)| *.jpg|"</span> + ;<br /> <span style="color: #ff0000;">"GIF (*.gif)| *.gif|"</span> + ;<br /> <span style="color: #ff0000;">"TARGA (*.tga)| *.tga|"</span> + ;<br /> <span style="color: #ff0000;">"RLE (*.rle)| *.rle|"</span> + ;<br /> <span style="color: #ff0000;">"All Files (*.*)| *.*"</span> ;<br /> ,<span style="color: #ff0000;">"Please select a image file"</span>, <span style="color: #000000;">4</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> ! Empty<span style="color: #000000;">(</span> gcFile <span style="color: #000000;">)</span> .and. File<span style="color: #000000;">(</span> gcFile <span style="color: #000000;">)</span><br /> oImage:<span style="color: #000000;">LoadBmp</span><span style="color: #000000;">(</span> gcFile <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> gcFile<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> PrintImage<span style="color: #000000;">(</span> oImage <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oPrn<br /><br /> <span style="color: #00C800;">PRINT</span> oPrn <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"Image Printing"</span> PREVIEW<br /> <span style="color: #0000ff;">PAGE</span><br /> oPrn:<span style="color: #000000;">SayImage</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, oImage <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ENDPAGE</span><br /> <span style="color: #0000ff;">ENDPRINT</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#define</span> SRCCOPY 0x00CC0020<br /><br /><span style="color: #00C800;">CLASS</span> ZoomZone<br /><br /> <span style="color: #00C800;">DATA</span> oImage<br /> <span style="color: #00C800;">DATA</span> nRow, nCol <br /> <span style="color: #00C800;">DATA</span> lPressed<br /> <br /> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">METHOD</span> LButtonDown<span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">METHOD</span> LButtonUp<span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">METHOD</span> SelectZone<span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">New</span><span style="color: #000000;">(</span> oImage <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> ZoomZone<br /><br /> ::<span style="color: #000000;">oImage</span> = oImage<br /> <br /> ::<span style="color: #000000;">lPressed</span> = .F.<br /> <br /> <br /> oImage:<span style="color: #000000;">bMMoved</span> = <span style="color: #000000;">{</span>| nRow, nCol | ::<span style="color: #000000;">SelectZone</span><span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oImage:<span style="color: #000000;">bLClicked</span> = <span style="color: #000000;">{</span>| nRow, nCol | ::<span style="color: #000000;">LButtonDown</span><span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oImage:<span style="color: #000000;">bLButtonUp</span> = <span style="color: #000000;">{</span>| nRow, nCol | ::<span style="color: #000000;">LButtonUp</span><span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> <br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">Self</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> LButtonDown<span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> ZoomZone<br /> <br /> ::<span style="color: #000000;">nRow</span> = nRow<br /> ::<span style="color: #000000;">nCol</span> = nCol<br /> ::<span style="color: #000000;">lPressed</span> = .T.<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> LButtonuP<span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> ZoomZone<br /><br /> <span style="color: #00C800;">local</span> hBmp, hBmpOld<br /> <span style="color: #00C800;">local</span> hDCDesk := GetDC<span style="color: #000000;">(</span> GetDesktopWindow<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> hDCMem := CreateCompatibleDC<span style="color: #000000;">(</span> hDCDesk <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> hDCImg := ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">GetDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> nLowRow, nHiRow, nLowCol, nHiCol<br /> <br /> hBmp = CreateCompatibleBitmap<span style="color: #000000;">(</span> hDCDesk, ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">nWidth</span>, ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">nHeight</span> <span style="color: #000000;">)</span><br /> hBmpOld = SelectObject<span style="color: #000000;">(</span> hDCMem, hBmp <span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">nRow</span> > nRow<br /> nLowRow = nRow + <span style="color: #000000;">1</span><br /> nHiRow = ::<span style="color: #000000;">nRow</span><br /> <span style="color: #00C800;">else</span> <br /> nLowRow = ::<span style="color: #000000;">nRow</span> + <span style="color: #000000;">1</span><br /> nHiRow = nRow<br /> <span style="color: #00C800;">endif</span> <br /><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">nCol</span> > nCol<br /> nLowCol = nCol + <span style="color: #000000;">1</span><br /> nHiCol = ::<span style="color: #000000;">nCol</span><br /> <span style="color: #00C800;">else</span> <br /> nLowCol = ::<span style="color: #000000;">nCol</span> + <span style="color: #000000;">1</span><br /> nHiCol = nCol<br /> <span style="color: #00C800;">endif</span> <br /> <br /> StretchBlt<span style="color: #000000;">(</span> hDCMem, <span style="color: #000000;">0</span>, <span style="color: #000000;">0</span>, ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">nWidth</span>, ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">nHeight</span>, ;<br /> hDCImg, nLowCol, nLowRow, nHiCol - nLowCol, nHiRow - nLowRow, SRCCOPY <span style="color: #000000;">)</span> <br /> <br /> <br /> SelectObject<span style="color: #000000;">(</span> hDCMem, hBmpOld <span style="color: #000000;">)</span><br /> DeleteObject<span style="color: #000000;">(</span> ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">hBitmap</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">hBitmap</span> = hBmp<br /> DeleteDC<span style="color: #000000;">(</span> hDCMem <span style="color: #000000;">)</span><br /> ReleaseDC<span style="color: #000000;">(</span> GetDesktopWindow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, hDCDesk <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ::<span style="color: #000000;">lPressed</span> = .F.<br /> ::<span style="color: #000000;">oImage</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">METHOD</span> SelectZone<span style="color: #000000;">(</span> nRow, nCol <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> ZoomZone<br /><br /> <span style="color: #00C800;">local</span> hDC <br /><br /> ::<span style="color: #000000;">oImage</span>:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> SysRefresh<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> hDC := ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">GetDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">lPressed</span><br /> DrawDotedBox<span style="color: #000000;">(</span> hDC, ::<span style="color: #000000;">nRow</span>, ::<span style="color: #000000;">nCol</span>, nRow , nCol, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> ::<span style="color: #000000;">oImage</span>:<span style="color: #000000;">ReleaseDC</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#pragma</span> BEGINDUMP<br /><span style="color: #00D7D7;">#include</span> <windows.h><br /><span style="color: #00D7D7;">#include</span> <hbapi.h><br /><br />void WndDrawBox<span style="color: #000000;">(</span> HDC hDC, RECT * rct, HPEN hPUpLeft, HPEN hPBotRit <span style="color: #000000;">)</span>;<br /><br /><span style="color: #00C800;">HB_FUNC</span><span style="color: #000000;">(</span> DRAWDOTEDBOX <span style="color: #000000;">)</span><span style="color: #000000;">{</span><br /> RECT rct;<br /> COLORREF <span style="color: #0000ff;">color</span> = <span style="color: #000000;">(</span> COLORREF <span style="color: #000000;">)</span> hb_parnl<span style="color: #000000;">(</span> <span style="color: #000000;">6</span> <span style="color: #000000;">)</span>;<br /> HPEN hPen = CreatePen<span style="color: #000000;">(</span> PS_DOT, <span style="color: #000000;">1</span>, <span style="color: #0000ff;">color</span> <span style="color: #000000;">)</span>;<br /> <br /> rct.top = hb_parni<span style="color: #000000;">(</span> <span style="color: #000000;">2</span> <span style="color: #000000;">)</span>;<br /> rct.<span style="color: #0000ff;">left</span> = hb_parni<span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span>;<br /> rct.bottom = hb_parni<span style="color: #000000;">(</span> <span style="color: #000000;">4</span> <span style="color: #000000;">)</span>;<br /> rct.<span style="color: #0000ff;">right</span> = hb_parni<span style="color: #000000;">(</span> <span style="color: #000000;">5</span> <span style="color: #000000;">)</span>;<br /><br /> WndDrawBox<span style="color: #000000;">(</span> <span style="color: #000000;">(</span> HDC <span style="color: #000000;">)</span> hb_parnl<span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>, &rct, hPen, hPen <span style="color: #000000;">)</span>;<br /><br /> DeleteObject<span style="color: #000000;">(</span> hPen <span style="color: #000000;">)</span>;<br /> <br /><span style="color: #000000;">}</span><br /><br /><span style="color: #00D7D7;">#pragma</span> ENDDUMP<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><br /><br /> </div>[/code:33b3y62k]
|
Ampliar Imagen por zona de seleccion
|
Hola Daniel:
Que voy a decir de ti, excepto que eres un genio. Muchas gracias, sin tu ayuda en el foro, estariamos bien jodidos.
Yo lo lograba hacer que se marcara la zona con el raton.
Muchas gracias por tu tiempo y ayuda.
P.D Has mirado ya el tema del Cursor en el xBrowse?, bueno cuando lo mires ya me diras
Un saludo
JLL
|
Ampliar Imagen por zona de seleccion
|
DAniel,
When I zoom the image iti is wrong...How I can set the % of zoom ?
|
Ampliar Imagen por zona de seleccion
|
Silvio
the sample working fine to me...
the sample work selecting a image area, this image will be zoomed and fill all container area. The sample you can not catch and move the image only select a area to zoom
the function doing [url=http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_stretchblt:29bdhaed]StretchBlt[/url:29bdhaed] all magic
you can calculate percent of nWidth and nHeight and set the new value in function StretchBlt
|
Ampliar informacion de checkres.txt
|
Buenos dias
Podria ser posible que al crear el fichero [b:3gqulee0]checkres.txt[/b:3gqulee0] incluyese en la linea o al principio del volcado el programa.EXE que lo genera?
Por ejemplo
[quote:3gqulee0]
Ahora obtenemos:
03/08/2014 11:29:35: FONT,-1844833697,TWINDOWSUI:SRIGHTUPUI(2271)->MAIN(155)
Y creo que podría ser interesante:
03/08/2014 11:29:35: APLICACION.EXE -- FONT,-1844833697,TWINDOWSUI:SRIGHTUPUI(2271)->MAIN(155)
[/quote:3gqulee0]
|
Ampliar informacion de checkres.txt
|
Cristobal,
Añadido para FWH 14.07
Solo hay que cambiar asi esta función en source\function\checkres.prg:
[code=fw:hrcxwut2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> CheckRes<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cInfo := <span style="color: #ff0000;">""</span>, n<br /> <br /> <span style="color: #00C800;">for</span> n = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> Len<span style="color: #000000;">(</span> aResources <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> aResources<span style="color: #000000;">[</span> n, <span style="color: #000000;">2</span> <span style="color: #000000;">]</span> != <span style="color: #000000;">0</span><br /> cInfo = GetModuleFileName<span style="color: #000000;">(</span> GetInstance<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" -- "</span> + ;<br /> aResources<span style="color: #000000;">[</span> n, <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> + <span style="color: #ff0000;">","</span> + AllTrim<span style="color: #000000;">(</span> Str<span style="color: #000000;">(</span> aResources<span style="color: #000000;">[</span> n, <span style="color: #000000;">2</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + ;<br /> <span style="color: #ff0000;">","</span> + aResources<span style="color: #000000;">[</span> n, <span style="color: #000000;">3</span> <span style="color: #000000;">]</span> + CRLF<br /> LogFile<span style="color: #000000;">(</span> <span style="color: #ff0000;">"checkres.txt"</span>, <span style="color: #000000;">{</span> cInfo <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">next</span> <br /><br /> LogFile<span style="color: #000000;">(</span> <span style="color: #ff0000;">"checkres.txt"</span>, <span style="color: #000000;">{</span> GetModuleFileName<span style="color: #000000;">(</span> GetInstance<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" -- "</span> + ;<br /> Replicate<span style="color: #000000;">(</span> <span style="color: #ff0000;">"="</span>, <span style="color: #000000;">100</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> <br /> </div>[/code:hrcxwut2]
|
Ampliar informacion de checkres.txt
|
Antonio, no hay nada mejor que llegar en el momento justo <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Gracias
|
Ampliar informacion de checkres.txt
|
<!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
|
An Extra Option for buttons and a Thank You
|
Firstly a big thank you to Antonio for his recent help changing default selection when tabbing through GETs. Combined with my workaround for controlling tab order it has made for some nice comments from my end users and made them more productive.
Whilst I was controlling the order when tabbing through GETs and keeping buttons that should not have been tabbed through avoided, there remained the issue of these buttons grabbing the focus when clicked on.
That was relatively easy to fix by adding the following code to buttons.c
[code:vk0jaexi]HB_FUNC( BTNNOFOCUS )
{
gtk_button_set_focus_on_click( GTK_BUTTON( hb_parnl( 1 ) ), FALSE );
}[/code:vk0jaexi]
and this to button.prg
[code:vk0jaexi] METHOD SetNoFocusOnClick() INLINE BtnNoFocus( ::hWnd )[/code:vk0jaexi]
now if you code as follows
[code:vk0jaexi]oBtn:SetNoFocusOnClick()[/code:vk0jaexi]
then when you click on oBtn the focus will stay set where it was.
I note that this might be very useful for buttons on toolbars.
Also a question to Antonio and other users. Should this be an option on BUTTON creation - in other words should @ row, col BUTTON command have a new clause, maybe NOFOCUS, to support such a capability directly rather than code along the following lines
[code:vk0jaexi]@ row, col BUTTON oBtn PROMPT "Some Prompt" ACTION( etc
oBtn:SetNoFocusOnClick()[/code:vk0jaexi]
just do it in one line
[code:vk0jaexi]@ row, col BUTTON "Some Prompt" NOFOCUS ACTION( etc[/code:vk0jaexi]
Regards
Doug
(xProgrammer)
|
An addition to Tget Class - METHOD ScrollTime( nDirection)
|
Hi Friends,
I was in need of this method like ScrollDate method in TGet Class and I have put little effort on this.
If anybody feels that this is useful, they can make use of it by adding an additional method in TGet Class :
METHOD ScrollTime( nDirection ) under METHOD ScrollDate(nDirection)
Regards,
- Ramesh Babu P
[code=fw:3f7mj335]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br />* <span style="color: #00C800;">Method</span> Added by RAMESH BABU P <span style="color: #0000ff;">on</span> <span style="color: #000000;">13</span><span style="color: #000000;">-06</span><span style="color: #000000;">-2010</span><br /><span style="color: #00C800;">METHOD</span> ScrollTime<span style="color: #000000;">(</span> nDirection <span style="color: #000000;">)</span> <span style="color: #00C800;">CLASS</span> TGet<br /><br /> <span style="color: #00C800;">LOCAL</span> cFormat, cType<br /> <span style="color: #00C800;">LOCAL</span> cTime<br /> <span style="color: #00C800;">LOCAL</span> nHours, nMinutes, nSeconds, nPos<br /><br /> #ifndef __XPP__<br /> cTime := ::<span style="color: #000000;">Value</span><br /> #else<br /> cTime := ::<span style="color: #000000;">VarGet</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> #endif<br /><br /> nPos := ::<span style="color: #000000;">nPos</span><br /> cFormat := Set<span style="color: #000000;">(</span> _SET_TIMEFORMAT, <span style="color: #ff0000;">"hh:mm:ss"</span><span style="color: #000000;">)</span> <br /> nHours := VAL<span style="color: #000000;">(</span><span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span>cTime,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> nMinutes := VAL<span style="color: #000000;">(</span><span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span>cTime,<span style="color: #000000;">4</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> nSeconds := VAL<span style="color: #000000;">(</span><span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">(</span>cTime,<span style="color: #000000;">7</span>,<span style="color: #000000;">2</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> cType := Upper<span style="color: #000000;">(</span> <span style="color: #0000ff;">Substr</span><span style="color: #000000;">(</span> cFormat, nPos, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">If</span> ! cType $ <span style="color: #ff0000;">"HMS"</span> .and. nPos > <span style="color: #000000;">1</span><br /> cType = Upper<span style="color: #000000;">(</span> <span style="color: #0000ff;">Substr</span><span style="color: #000000;">(</span> cFormat, nPos - <span style="color: #000000;">1</span>, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /><br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br /> <span style="color: #00C800;">case</span> nPos <= <span style="color: #000000;">2</span><br /> nHours += nDirection<br /> <span style="color: #00C800;">If</span> nHours ><span style="color: #000000;">24</span> .OR. nHours < <span style="color: #000000;">0</span><br /> nHours := <span style="color: #000000;">0</span><br /> nMinutes := <span style="color: #000000;">0</span><br /> nSeconds := <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">Endif</span><br /><br /> cTime := StrZero<span style="color: #000000;">(</span> nHours, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span> + StrZero<span style="color: #000000;">(</span> nMinutes, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span> + StrZero<span style="color: #000000;">(</span> nSeconds, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">case</span> nPos ><span style="color: #000000;">3</span> .AND. nPos <= <span style="color: #000000;">5</span><br /> nMinutes += nDirection<br /> <span style="color: #00C800;">if</span> nMinutes > <span style="color: #000000;">59</span><br /> nHours += <span style="color: #000000;">1</span><br /> nMinutes := <span style="color: #000000;">0</span><br /> Elseif nMinutes < <span style="color: #000000;">0</span><br /> nMinutes := <span style="color: #000000;">59</span><br /> nHours -= <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">If</span> nHours < <span style="color: #000000;">0</span><br /> nHours := <span style="color: #000000;">0</span><br /> nMinutes := <span style="color: #000000;">0</span><br /> nSeconds := <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">Endif</span> <br /> <span style="color: #00C800;">Endif</span> <br /> cTime := StrZero<span style="color: #000000;">(</span> nHours, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span> + StrZero<span style="color: #000000;">(</span> nMinutes, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span> + StrZero<span style="color: #000000;">(</span> nSeconds, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">If</span> Empty<span style="color: #000000;">(</span> cTime <span style="color: #000000;">)</span><br /> cTime := <span style="color: #ff0000;">"00:00:00"</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">case</span> nPos ><span style="color: #000000;">6</span> .AND. nPos <= <span style="color: #000000;">8</span><br /> nSeconds += nDirection<br /> <span style="color: #00C800;">If</span> nSeconds > <span style="color: #000000;">59</span><br /> nSeconds := <span style="color: #000000;">0</span><br /> nMinutes += <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">If</span> nMinutes ><span style="color: #000000;">59</span><br /> nMinutes := <span style="color: #000000;">0</span><br /> nHours += <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">Endif</span><br /> Elseif nSeconds < <span style="color: #000000;">0</span><br /> nSeconds := <span style="color: #000000;">59</span><br /> nMinutes -= <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">If</span> nMinutes < <span style="color: #000000;">0</span><br /> nHours -= <span style="color: #000000;">1</span><br /> nMinutes := <span style="color: #000000;">59</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">If</span> nHours < <span style="color: #000000;">0</span><br /> nHours := <span style="color: #000000;">0</span><br /> nMinutes := <span style="color: #000000;">0</span><br /> nSeconds := <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">Endif</span> <br /> <span style="color: #00C800;">Endif</span> <br /> cTime := StrZero<span style="color: #000000;">(</span> nHours, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span> + StrZero<span style="color: #000000;">(</span> nMinutes, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span> + StrZero<span style="color: #000000;">(</span> nSeconds, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endcase</span><br /><br /> Set<span style="color: #000000;">(</span> _SET_TIMEFORMAT, cFormat <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> nDirection > <span style="color: #000000;">0</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">bMax</span> != <span style="color: #00C800;">NIL</span> .and. cTime > Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bMax</span> <span style="color: #000000;">)</span><br /> MessageBeep<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">cText</span><span style="color: #000000;">(</span> cTime <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> ::<span style="color: #000000;">bMin</span> != <span style="color: #00C800;">NIL</span> .and. cTime < Eval<span style="color: #000000;">(</span> ::<span style="color: #000000;">bMin</span> <span style="color: #000000;">)</span><br /> MessageBeep<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> ::<span style="color: #000000;">cText</span><span style="color: #000000;">(</span> cTime <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br />#ifndef __CLIPPER__<br /> <span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br /> <span style="color: #00C800;">case</span> cType == <span style="color: #ff0000;">"H"</span><br /> ::<span style="color: #000000;">SetSel</span><span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">case</span> cType == <span style="color: #ff0000;">"M"</span><br /> ::<span style="color: #000000;">SetSel</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span>, <span style="color: #000000;">5</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">nPos</span> := <span style="color: #000000;">5</span><br /> <span style="color: #00C800;">case</span> cType == <span style="color: #ff0000;">"S"</span><br /> ::<span style="color: #000000;">SetSel</span><span style="color: #000000;">(</span> <span style="color: #000000;">6</span>, <span style="color: #000000;">8</span> <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">nPos</span> := Len<span style="color: #000000;">(</span>cTime<span style="color: #000000;">)</span> - <span style="color: #000000;">1</span><br /> end <span style="color: #00C800;">case</span><br />#else<br /> ::<span style="color: #000000;">SetPos</span><span style="color: #000000;">(</span> nPos <span style="color: #000000;">)</span><br />#endif<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:3f7mj335]
|
An addition to Tget Class - METHOD ScrollTime( nDirection)
|
Ramesh,
Many thanks! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
An addition to Tget Class - METHOD ScrollTime( nDirection)
|
Dear Mr.Antonio,
This is our FWH. No thanks please.
Warm regards,
- Ramesh Babu P
|
An advice needed to save same variables and its value to mem
|
Hi,
I have an array like that. First element is variable name, second is variables value.
[code=fw:e6c30anl]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"Name"</span>,<span style="color: #ff0000;">"Hakan"</span><span style="color: #000000;">}</span>,<br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"Birthday"</span>, <span style="color: #000000;">15.11</span><span style="color: #000000;">.1960</span><span style="color: #000000;">}</span>,<br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"Married"</span>, .F.<span style="color: #000000;">}</span>,<br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"Tips"</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"aaa"</span>,<span style="color: #ff0000;">"bbb"</span>,<span style="color: #ff0000;">"ccc"</span>,<span style="color: #ff0000;">"ddd"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>,<br /><span style="color: #000000;">{</span><span style="color: #ff0000;">"DoorNumber"</span>, <span style="color: #000000;">456</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span></div>[/code:e6c30anl]
I want to save this array to one memo field in a record. (DBF) and read again to its variable names.
Is there any simple efficient solution already prepared?
Thanks.
|
An advice needed to save same variables and its value to mem
|
[code=fw:1ngy4ln4]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Function</span> TestArr1<span style="color: #000000;">(</span> nOpt <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aVars := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Name"</span>,<span style="color: #ff0000;">"Hakan"</span><span style="color: #000000;">}</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"Birthday"</span>, <span style="color: #ff0000;">"15.11.1960"</span> <span style="color: #000000;">}</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"Married"</span>, .F.<span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Tips"</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"aaa"</span>,<span style="color: #ff0000;">"bbb"</span>,<span style="color: #ff0000;">"ccc"</span>,<span style="color: #ff0000;">"ddd"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"DoorNumber"</span>, <span style="color: #000000;">456</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">if</span> nOpt = <span style="color: #000000;">2</span><br /> ? FW_ValToExp<span style="color: #000000;">(</span> aVars <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> &<span style="color: #000000;">(</span>FW_ValToExp<span style="color: #000000;">(</span> aVars <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:1ngy4ln4]
But I would surely use a hash to store the variables
|
An advice needed to save same variables and its value to mem
|
field->memo := hb_serialize( aVars )
...
aVars := hb_deserialize( field->memo )
|
An advice needed to save same variables and its value to mem
|
Thank you Mr. Navarro, Antonio,
I will look it.
|
An advice needed to save same variables and its value to mem
|
[u:2pgm7kw8][b:2pgm7kw8]Saving and restoring arrays to and from MemoFields of DBF
[/b:2pgm7kw8][/u:2pgm7kw8]
Using DBFCDX, we can save an array in a memo field like this:
[code=fw:2pgm7kw8]<div class="fw" id="{CB}" style="font-family: monospace;"><br />FIELD->MEMOFIELD := aVars<br /> </div>[/code:2pgm7kw8]
Later, we can read the data into array like this
[code=fw:2pgm7kw8]<div class="fw" id="{CB}" style="font-family: monospace;"><br />aVars := FIELD->MEMOFIELD<br /> </div>[/code:2pgm7kw8]
You can build and run this program to test this:
[code=fw:2pgm7kw8]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aVars := <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"Name"</span>,<span style="color: #ff0000;">"Hakan"</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Birthday"</span>, <span style="color: #000000;">{</span>^ <span style="color: #000000;">1960</span>/<span style="color: #000000;">11</span>/<span style="color: #000000;">15</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Married"</span>, .F.<span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Tips"</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"aaa"</span>,<span style="color: #ff0000;">"bbb"</span>,<span style="color: #ff0000;">"ccc"</span>,<span style="color: #ff0000;">"ddd"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"DoorNumber"</span>, <span style="color: #000000;">456</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /><br /> SET DATE FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"DD.MM.YYYY"</span><br /><br /> <span style="color: #00C800;">if</span> !File<span style="color: #000000;">(</span> <span style="color: #ff0000;">"TESTVARS.DBF"</span> <span style="color: #000000;">)</span><br /> DBCREATE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"TESTVARS"</span>, <span style="color: #000000;">{</span><span style="color: #000000;">{</span> <span style="color: #ff0000;">"MYVARS"</span>, <span style="color: #ff0000;">"M"</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span><span style="color: #000000;">}</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T., <span style="color: #ff0000;">"VARS"</span> <span style="color: #000000;">)</span><br /> DBAPPEND<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> CLOSE VARS<br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #B900B9;">// save to memofield</span><br /> USE TESTVARS VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> TESTVARS->MYVARS := aVars<br /> CLOSE TESTVARS<br /><br /> aVars := <span style="color: #00C800;">nil</span><br /><br /> <span style="color: #B900B9;">// read array from memofield</span><br /> USE TESTVARS VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> aVars := TESTVARS->MYVARS<br /> CLOSE TESTVARS<br /><br /> XBROWSER aVars<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:2pgm7kw8]
[url=https://imageshack.com/i/pmCdlvkxp:2pgm7kw8][img:2pgm7kw8]https://imagizer.imageshack.com/v2/xq90/922/Cdlvkx.png[/img:2pgm7kw8][/url:2pgm7kw8]
This way we can read the saved names and values into an array. I do not think this is what you are looking for. You said:
[quote:2pgm7kw8]
I want to save this array to one memo field in a record. (DBF) and read again to its variable names.
[/quote:2pgm7kw8]
I understand that you want to read the saved names and values and then create variables with those names and values for use in your application.
This is possible with PUBLIC or PRIVATE variables but not local or static variables.
If what I understand is correct, please see the next post.
|
An advice needed to save same variables and its value to mem
|
[u:2xs6oyig][b:2xs6oyig]Using SAVE/RESTORE commands:[/b:2xs6oyig][/u:2xs6oyig]
Before going into saving and restoring variables to/from memo-fields of DBF, let us review the built-in Clipper commands SAVE/RESTORE. These commands are as old as clipper itself and are intended for saving names and values of variables to disk and restoring variables with values later. The values are saved to disk files with extension MEM by default.
Can save and restore PUBLIC and PRIVATE variables with values Character, Date, Logical and Numeric only. Variables with other values like DateTime, Array, Codeblock, etc.
Syntax:
[code=fw:2xs6oyig]<div class="fw" id="{CB}" style="font-family: monospace;"><br />SAVE <span style="color: #0000ff;">TO</span> <memFilename> <span style="color: #000000;">[</span>ALL <span style="color: #000000;">[</span><span style="color: #0000ff;">LIKE</span> | EXCEPT <mask><span style="color: #000000;">]</span><span style="color: #000000;">]</span><br />RESTORE <span style="color: #0000ff;">FROM</span> <memFilename> <span style="color: #000000;">[</span>ADDITIVE<span style="color: #000000;">]</span><br /> </div>[/code:2xs6oyig]
This is the test program to save and restore our variables, viz., Name, Birthday, Married, Tips and DoorNumber, using SAVE/RESTORE commands:
[code=fw:2xs6oyig]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />MEMVAR <span style="color: #0000ff;">Name</span>, Birthday, Married, Tips, DoorNumber<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> SET DATE FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"DD.MM.YYYY"</span><br /><br /> <span style="color: #00C800;">if</span> File<span style="color: #000000;">(</span> <span style="color: #ff0000;">"MYVAR.MEM"</span> <span style="color: #000000;">)</span><br /> RESTORE <span style="color: #0000ff;">FROM</span> MYVAR ADDITIVE<br /> Tips := &Tips<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">PUBLIC</span> <span style="color: #0000ff;">Name</span> := <span style="color: #ff0000;">"Hakan"</span>, ;<br /> Birthday := <span style="color: #000000;">{</span>^ <span style="color: #000000;">1960</span>/<span style="color: #000000;">11</span>/<span style="color: #000000;">15</span> <span style="color: #000000;">}</span>, ;<br /> Married := .F., ;<br /> Tips := <span style="color: #000000;">{</span> <span style="color: #ff0000;">"aaa"</span>, <span style="color: #ff0000;">"bbb"</span>, <span style="color: #ff0000;">"ccc"</span>, <span style="color: #ff0000;">"ddd"</span> <span style="color: #000000;">}</span>, ;<br /> DoorNumber := <span style="color: #000000;">456</span><br /> <span style="color: #00C800;">endif</span><br /><br /> ? <span style="color: #0000ff;">Name</span>, Birthday, Married, DoorNumber<br /><br /> <span style="color: #B900B9;">// Use the variables</span><br /> EDITVARS <span style="color: #0000ff;">Name</span>,Birthday,Married,DoorNumber<br /> XBROWSER Tips FASTEDIT <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Tips"</span><br /><br /> <span style="color: #B900B9;">// Finally Save</span><br /> Tips := FW_ValToExp<span style="color: #000000;">(</span> Tips <span style="color: #000000;">)</span><br /> SAVE <span style="color: #0000ff;">TO</span> MYVAR ALL<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:2xs6oyig]
The SAVE/RESTORE commands are very reliable and in most cases enough for saving and restoring variable names and values across sessions of the same appilcation as well as for communication between applications. A lot simpler than saving to DBF or others.
Before going to the next post, please do build and run this program. In the first run you will see the original values. Modify the values as you like. In the second run, you will see the modified values.
[url=https://imageshack.com/i/po2OalEig:2xs6oyig][img:2xs6oyig]https://imagizer.imageshack.com/img924/4435/2OalEi.gif[/img:2xs6oyig][/url:2xs6oyig]
If for some reason, you insist on saving to DBF but not to MEM files, please see the next post.
|
An advice needed to save same variables and its value to mem
|
[u:jfhusov8][b:jfhusov8]Saving/Restoring variables and values to/from Memo Field of DBF[/b:jfhusov8][/u:jfhusov8]
This sample saves the variable names and values to memofield of dbf and restores ane initiates the variables.
The functionality and behavior are identical to the previous sample.
[code=fw:jfhusov8]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<br /><br />#xcommand SAVE VARS <v1><span style="color: #000000;">[</span>,<vN><span style="color: #000000;">]</span> <span style="color: #0000ff;">TO</span> FIELD <fld> => <fld> := \<span style="color: #000000;">{</span> \<span style="color: #000000;">{</span> <<span style="color: #ff0000;">"v1"</span>>, <v1> \<span style="color: #000000;">}</span> <span style="color: #000000;">[</span>,\<span style="color: #000000;">{</span> <<span style="color: #ff0000;">"vN"</span>>, <vN> \<span style="color: #000000;">}</span><span style="color: #000000;">]</span> \<span style="color: #000000;">}</span><br />#xcommand RESTORE VARS <span style="color: #0000ff;">FROM</span> FIELD <fld> => AEval<span style="color: #000000;">(</span> <fld>, <span style="color: #000000;">{</span> |a | &<span style="color: #000000;">(</span> a\<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> \<span style="color: #000000;">]</span> <span style="color: #000000;">)</span> := a\<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> \<span style="color: #000000;">]</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> SET DATE FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"DD.MM.YYYY"</span><br /><br /> <span style="color: #00C800;">PUBLIC</span> <span style="color: #0000ff;">Name</span>, Birthday, Married, Tips, DoorNumber<br /><br /> <span style="color: #00C800;">if</span> !File<span style="color: #000000;">(</span> <span style="color: #ff0000;">"MYVARS.DBF"</span> <span style="color: #000000;">)</span><br /> DBCREATE<span style="color: #000000;">(</span> <span style="color: #ff0000;">"MYVARS"</span>, <span style="color: #000000;">{</span><span style="color: #000000;">{</span> <span style="color: #ff0000;">"MYVARS"</span>, <span style="color: #ff0000;">"M"</span>, <span style="color: #000000;">8</span>, <span style="color: #000000;">0</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>, <span style="color: #ff0000;">"DBFCDX"</span>, .T., <span style="color: #ff0000;">"MYVARS"</span> <span style="color: #000000;">)</span><br /> DBAPPEND<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> FIELD->MYVARS := <span style="color: #000000;">{</span><span style="color: #000000;">{</span><span style="color: #ff0000;">"Name"</span>,<span style="color: #ff0000;">"Hakan"</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Birthday"</span>, <span style="color: #000000;">{</span>^ <span style="color: #000000;">1960</span>/<span style="color: #000000;">11</span>/<span style="color: #000000;">15</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Married"</span>, .F.<span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"Tips"</span>, <span style="color: #000000;">{</span><span style="color: #ff0000;">"aaa"</span>,<span style="color: #ff0000;">"bbb"</span>,<span style="color: #ff0000;">"ccc"</span>,<span style="color: #ff0000;">"ddd"</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span>, ;<br /> <span style="color: #000000;">{</span><span style="color: #ff0000;">"DoorNumber"</span>, <span style="color: #000000;">456</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span><br /> CLOSE MYVARS<br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #B900B9;">// Read and initialize variables from memofield</span><br /> USE MYVARS <span style="color: #00C800;">NEW</span> SHARED READONLY VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> RESTORE VARS <span style="color: #0000ff;">FROM</span> FIELD MYVARS->MYVARS<br /> CLOSE MYVARS<br /><br /> ? <span style="color: #0000ff;">Name</span>, Birthday, Married, DoorNumber<br /><br /> <span style="color: #B900B9;">// Use the variables</span><br /> EDITVARS <span style="color: #0000ff;">Name</span>,Birthday,Married,DoorNumber<br /> XBROWSER Tips FASTEDIT <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Tips"</span><br /><br /> <span style="color: #B900B9;">// Finally Save to memofield</span><br /> USE MYVARS <span style="color: #00C800;">NEW</span> SHARED VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> <span style="color: #00C800;">if</span> MYVARS-><span style="color: #000000;">(</span> DbRLock<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> SAVE VARS <span style="color: #0000ff;">Name</span>, Birthday, Married, Tips, DoorNumber <span style="color: #0000ff;">to</span> FIELD MYVARS->MYVARS<br /> <span style="color: #00C800;">endif</span><br /> CLOSE MYVARS<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:jfhusov8]
|
An advice needed to save same variables and its value to mem
|
Thank you very much for full support.
I have solved my problem with yours great suport. This informations should be in wiki.
|
An easy way to make a tree-browse
|
[code=fw:1z2f0qi9]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br />REQUEST DBFCDX<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> field STATE,HIREDATE,CITY<br /> <span style="color: #00C800;">local</span> oDlg, oFont, oBrw<br /><br /> USE CUSTOMER <span style="color: #00C800;">NEW</span> SHARED VIA <span style="color: #ff0000;">"DBFCDX"</span><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> STATE + STR<span style="color: #000000;">(</span>INT<span style="color: #000000;">(</span><span style="color: #0000ff;">YEAR</span><span style="color: #000000;">(</span>HIREDATE<span style="color: #000000;">)</span>/<span style="color: #000000;">10</span><span style="color: #000000;">)</span>*<span style="color: #000000;">10</span>,<span style="color: #000000;">4</span><span style="color: #000000;">)</span> + CITY TAG STATEYR <span style="color: #0000ff;">TO</span> TMP MEMORY<br /> GO TOP<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-14</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">700</span>,<span style="color: #000000;">600</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE <span style="color: #ff0000;">"CUSTOMER"</span> ;<br /> COLUMNS <span style="color: #ff0000;">"STATE"</span>, <span style="color: #ff0000;">"STRZERO(INT(YEAR(HIREDATE)/10)*10,4) AS DECADE"</span>, ;<br /> <span style="color: #ff0000;">"CITY"</span>, <span style="color: #ff0000;">"FIRST"</span>, <span style="color: #ff0000;">"AGE"</span>, <span style="color: #ff0000;">"HIREDATE"</span>, <span style="color: #ff0000;">"SALARY"</span> ;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> FWDArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, FWRArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\t</span>reevh.bmp"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">SetTree</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">oTree</span>:<span style="color: #000000;">OpenAll</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> :<span style="color: #000000;">lDisplayZeros</span> := .f.<br /> <span style="color: #B900B9;">//</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:1z2f0qi9]
[url=https://imageshack.com/i/pn9n7p0Yp:1z2f0qi9][img:1z2f0qi9]https://imagizer.imageshack.com/v2/xq90/923/9n7p0Y.png[/img:1z2f0qi9][/url:1z2f0qi9]
|
An easy way to make a tree-browse
|
Could it be possible to auto-close the old tree on rowchange and open
the tree on new rowselection straight with a defined level ?
normal ( some mouseclicks needed ) :
1. click : level 1
2. click : level 2
3. click : close
4. click : new row
c
[img:rmp82ek7]http://www.pflegeplus.com/IMAGES/Tree6.jpg[/img:rmp82ek7]
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
An easy way to make a tree-browse
|
Mr. Rao,
I added 3 quick preview-buttons to Your sample.
is it possible to change a treelevel on button-action ?.
I mean close, show level 1 or 2
( I used oBrw:oTree:OpenAll() for level 2 )
[img:2uw7yjgl]http://www.pflegeplus.com/IMAGES/Tree5.jpg[/img:2uw7yjgl]
regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
An easy way to make a tree-browse
|
please see these methods
METHOD OpenAll()
METHOD Expand( nLevel )
METHOD Collapse( nLevel )
in linklist.prg
|
An easy way to make a tree-browse
|
Thank You very much.
The infos I've been looking for to switch between the different levels.
[color=#0000FF:1cf254zt][b:1cf254zt]@ 50[/b:1cf254zt],[/color:1cf254zt]20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" ;
COLUMNS "STATE", "STRZERO(INT(YEAR(HIREDATE)/10)*10,4) AS DECADE", ;
"CITY", "FIRST", "AGE", "HIREDATE", "SALARY" ;
CELL LINES NOBORDER
...
...
[color=#0000FF:1cf254zt] @ 10, 20 BTNBMP PROMPT "NO TREE" SIZE 100,30 PIXEL OF oDlg FLAT ;
ACTION ( oBrw:oTree:Collapse( 1 ), oBrw:Refresh() )
@ 10, 140 BTNBMP PROMPT "LEVEL 1" SIZE 100,30 PIXEL OF oDlg FLAT ;
ACTION ( oBrw:oTree:Expand( 2 ), oBrw:Refresh() )
@ 10, 260 BTNBMP PROMPT "LEVEL 2" SIZE 100,30 PIXEL OF oDlg FLAT ;
ACTION ( oBrw:oTree:OpenAll(), oBrw:Refresh() )[/color:1cf254zt]
best regards
Uwe <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
An easy way to make a tree-browse
|
Mr Rao,
Could you show us a little/easy sample about how to a xbrowse/tree from an array ?
|
An easy way to make a tree-browse
|
obrow2:setTree(otree)
ocol:=obrow2:aCols[ 1 ]
ocol:cheader:="????"
ocol:AddBitmap( { "tree1", "tree2", "treevh" } )
// ocol:cFooter := "GRAND TOTAL"
ocol:nEditType := {||if(::ledit,1,0)}
ocol:bEditValue := {||odb2:cquery:="select * from ac where acid='"+obrow2:oTreeItem:cPrompt+"'",odb2:refresh(),obrow2:oTreeItem:cPrompt}
// on chang ,to refresh other columns datas
oCol:bOnPostEdit := {|o, v, n|if( n != VK_ESCAPE ,obrow2:oTreeItem:cPrompt := padr(v,nacidlen," ") ,)}
ocol:bpopup:={||acc0501(,,obrow2)}
// right click call popu menu
// insert sub grade tree item, insert new tree item, delete tree item
ocol:bLDClickData:={||acc0502(obrow2:otreeitem),obrow2:otreeitem:Toggle(),obrow2:refresh()}
//ldbl click tree
// dynamic expand sub trees
oCol := obrow2:AddCol()
oCol:bStrData := {||odb2:descrip}
oCol:cHeader := "????"
oCol:bEditValue:= {||odb2:descrip}
oCol:nEditType:={||if(::ledit.and.!odb2:EOF(),1,0)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:descrip,(odb2:descrip:=v,odb2:save()) , ) }
oCol := obrow2:AddCol()
oCol:bStrData := {||odb2:currency}
oCol:cHeader := "??"
oCol:bEditValue:= {||odb2:currency}
ocol:nedittype:= {||if(::ledit.and.!odb2:EOF(),EDIT_GET_BUTTON,0)}
oCol:bEditBlock := {||currencybrw(odb2:currency)}
oCol:bOnPostEdit := {|o, v, n| if( n != VK_ESCAPE .and. v != odb2:currency,(v:=currencybrw(v,.t.),odb2:currency:=v,odb2:SAVE()) , ) }
oCol:nWidth := 60
....
// insert sub grade tree item, insert new tree item, delete tree item
FUNCTION acc0501(nrow,ncol,obrow2)
local itemid1,omenu2,acid1
MENU oMenu2 popup
MENUITEM "????" ACTION (acid1:=padr(obrow2:otreeitem:cprompt,nacidlen," "),msgget("???","",@acid1),;
oserver:query("insert into ac (acid,currency) select '"+acid1+"',currency from currency limit 1 on duplicate key update descrip=descrip"),;
if(MYSQL_AFFECTED_ROWS(oserver:nSocket)>0,(obrow2:otreeitem:add(acid1),obrow2:refresh()),))
MENUITEM "???? " ACTION (acid1:=padr(obrow2:otreeitem:cprompt,nacidlen," "),msgget("???","",@acid1),;
oserver:query("insert into ac (acid,facid,currency) select '"+acid1+"','"+obrow2:otreeitem:cprompt+"',currency from currency limit 1 on duplicate key update descrip=descrip"),;
if(MYSQL_AFFECTED_ROWS(oserver:nSocket)>0,(obrow2:otreeitem:addchild(acid1),obrow2:refresh()),))
MENUITEM "????" ACTION (if(msgyesno("??????","???"),(obrow2:odbf:DELETE(),if(!oserver:lerror,(obrow2:otreeitem:DELETE(),obrow2:refresh()),msgstop("?????????????????????????","??"))),))
ENDMENU
return oMenu2
// dynamic expand sub trees
FUNCTION acc0502(otreeitem)
local odb1,otreeitem2
if otreeitem:otree==nil
odb1:=oserver:query("select acid from ac where facid='"+otreeitem:cprompt+"'")
while !odb1:EOF()
otreeitem2:=otreeitem:addchild(odb1:acid)
acc0502(otreeitem2)
otreeitem2:Toggle()
odb1:SKIP()
end
odb1:end()
end
return
|
An easy way to make a tree-browse
|
[quote="vilian":1vt7jgmz]Mr Rao,
Could you show us a little/easy sample about how to a xbrowse/tree from an array ?[/quote:1vt7jgmz]
[code=fw:1vt7jgmz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aData, oTree<br /> <span style="color: #00C800;">local</span> oDlg, oFont, oBrw<br /><br /> aData := ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00100"</span>, <span style="color: #000000;">00</span>, <span style="color: #000000;">120</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00100"</span>, <span style="color: #000000;">01</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00100"</span>, <span style="color: #000000;">02</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00200"</span>, <span style="color: #000000;">00</span>, <span style="color: #000000;">120</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00200"</span>, <span style="color: #000000;">01</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00200"</span>, <span style="color: #000000;">02</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00300"</span>, <span style="color: #000000;">00</span>, <span style="color: #000000;">120</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00300"</span>, <span style="color: #000000;">01</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00300"</span>, <span style="color: #000000;">02</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #000000;">}</span><br /><br /> oTree := BuildTree<span style="color: #000000;">(</span> aData <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-15</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">450</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE oTree ;<br /> COLUMNS <span style="color: #000000;">2</span>, <span style="color: #000000;">3</span> ;<br /> HEADERS <span style="color: #ff0000;">"ITEM"</span>, <span style="color: #ff0000;">"PART"</span>, <span style="color: #ff0000;">"VALUE"</span> ;<br /> PICTURES <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">"@L 99"</span>, <span style="color: #ff0000;">"9,999.99"</span> ;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">lDisplayZeros</span> := .f.<br /> :<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> FWDArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, FWRArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, GetTreeBmps<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><span style="color: #B900B9;">/*<br /> :aCols[ 3 ]:bEditValue := { || ;<br /> If( oBrw:oTreeItem:nLevel == 1 .and. oBrw:oTreeItem:lOpened, 0, ;<br /> oBrw:oTreeItem:Cargo [ 3 ] ) }<br />*/</span><br /> :<span style="color: #000000;">bClrStd</span> := <span style="color: #000000;">{</span> || <span style="color: #000000;">{</span> CLR_BLACK, <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">oTreeItem</span>:<span style="color: #000000;">nLevel</span> == <span style="color: #000000;">1</span>, CLR_YELLOW, CLR_WHITE <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">//</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">function</span> BuildTree<span style="color: #000000;">(</span> aData <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oTree, oItem<br /> <span style="color: #00C800;">local</span> cGrp, aRow<br /><br /> TREE oTree<br /> <span style="color: #00C800;">for</span> each aRow in aData<br /> <span style="color: #00C800;">if</span> aRow<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> == cGrp<br /> <span style="color: #00C800;">if</span> oItem:<span style="color: #000000;">nLevel</span> == <span style="color: #000000;">1</span><br /> TREE<br /> <span style="color: #00C800;">endif</span><br /> TREEITEM oItem <span style="color: #0000ff;">PROMPT</span> aRow<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> + <span style="color: #ff0000;">"-"</span> + STRZERO<span style="color: #000000;">(</span> aRow<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> ;<br /> CARGO aRow<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> oItem != <span style="color: #00C800;">nil</span> .and. oItem:<span style="color: #000000;">nLevel</span> > <span style="color: #000000;">1</span><br /> ENDTREE<br /> <span style="color: #00C800;">endif</span><br /> cGrp := aRow<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span><br /> TREEITEM oItem <span style="color: #0000ff;">PROMPT</span> cGrp CARGO aRow<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">next</span><br /> ENDTREE<br /><br /> oTree:<span style="color: #000000;">OpenAll</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> oTree<br /> </div>[/code:1vt7jgmz]
|
An easy way to make a tree-browse
|
Thank you,
It's exactly I need <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
|
An easy way to make a tree-browse
|
[quote="nageswaragunupudi":151gqnqd][quote="vilian":151gqnqd]Mr Rao,
Could you show us a little/easy sample about how to a xbrowse/tree from an array ?[/quote:151gqnqd]
[code=fw:151gqnqd]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> aData, oTree<br /> <span style="color: #00C800;">local</span> oDlg, oFont, oBrw<br /><br /> aData := ;<br /> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00100"</span>, <span style="color: #000000;">00</span>, <span style="color: #000000;">120</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00100"</span>, <span style="color: #000000;">01</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00100"</span>, <span style="color: #000000;">02</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00200"</span>, <span style="color: #000000;">00</span>, <span style="color: #000000;">120</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00200"</span>, <span style="color: #000000;">01</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00200"</span>, <span style="color: #000000;">02</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00300"</span>, <span style="color: #000000;">00</span>, <span style="color: #000000;">120</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00300"</span>, <span style="color: #000000;">01</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> , <span style="color: #000000;">{</span> <span style="color: #ff0000;">"P00300"</span>, <span style="color: #000000;">02</span>, <span style="color: #000000;">60</span> <span style="color: #000000;">}</span> ;<br /> <span style="color: #000000;">}</span><br /><br /> oTree := BuildTree<span style="color: #000000;">(</span> aData <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">FONT</span> oFont <span style="color: #0000ff;">NAME</span> <span style="color: #ff0000;">"TAHOMA"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-15</span><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">450</span>,<span style="color: #000000;">400</span> <span style="color: #0000ff;">PIXEL</span> TRUEPIXEL <span style="color: #0000ff;">FONT</span> oFont<br /><br /> @ <span style="color: #000000;">20</span>,<span style="color: #000000;">20</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">-20</span>,<span style="color: #000000;">-20</span> <span style="color: #0000ff;">PIXEL</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> DATASOURCE oTree ;<br /> COLUMNS <span style="color: #000000;">2</span>, <span style="color: #000000;">3</span> ;<br /> HEADERS <span style="color: #ff0000;">"ITEM"</span>, <span style="color: #ff0000;">"PART"</span>, <span style="color: #ff0000;">"VALUE"</span> ;<br /> PICTURES <span style="color: #00C800;">nil</span>, <span style="color: #ff0000;">"@L 99"</span>, <span style="color: #ff0000;">"9,999.99"</span> ;<br /> CELL LINES NOBORDER<br /><br /> WITH OBJECT oBrw<br /> :<span style="color: #000000;">lDisplayZeros</span> := .f.<br /> :<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">AddBitmap</span><span style="color: #000000;">(</span> <span style="color: #000000;">{</span> FWDArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, FWRArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, GetTreeBmps<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><span style="color: #B900B9;">/*<br /> :aCols[ 3 ]:bEditValue := { || ;<br /> If( oBrw:oTreeItem:nLevel == 1 .and. oBrw:oTreeItem:lOpened, 0, ;<br /> oBrw:oTreeItem:Cargo [ 3 ] ) }<br />*/</span><br /> :<span style="color: #000000;">bClrStd</span> := <span style="color: #000000;">{</span> || <span style="color: #000000;">{</span> CLR_BLACK, <span style="color: #00C800;">If</span><span style="color: #000000;">(</span> oBrw:<span style="color: #000000;">oTreeItem</span>:<span style="color: #000000;">nLevel</span> == <span style="color: #000000;">1</span>, CLR_YELLOW, CLR_WHITE <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">//</span><br /> :<span style="color: #000000;">CreateFromCode</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">CENTERED</span><br /> <span style="color: #0000ff;">RELEASE</span> <span style="color: #0000ff;">FONT</span> oFont<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">function</span> BuildTree<span style="color: #000000;">(</span> aData <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oTree, oItem<br /> <span style="color: #00C800;">local</span> cGrp, aRow<br /><br /> TREE oTree<br /> <span style="color: #00C800;">for</span> each aRow in aData<br /> <span style="color: #00C800;">if</span> aRow<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> == cGrp<br /> <span style="color: #00C800;">if</span> oItem:<span style="color: #000000;">nLevel</span> == <span style="color: #000000;">1</span><br /> TREE<br /> <span style="color: #00C800;">endif</span><br /> TREEITEM oItem <span style="color: #0000ff;">PROMPT</span> aRow<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> + <span style="color: #ff0000;">"-"</span> + STRZERO<span style="color: #000000;">(</span> aRow<span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>, <span style="color: #000000;">2</span> <span style="color: #000000;">)</span> ;<br /> CARGO aRow<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #00C800;">if</span> oItem != <span style="color: #00C800;">nil</span> .and. oItem:<span style="color: #000000;">nLevel</span> > <span style="color: #000000;">1</span><br /> ENDTREE<br /> <span style="color: #00C800;">endif</span><br /> cGrp := aRow<span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span><br /> TREEITEM oItem <span style="color: #0000ff;">PROMPT</span> cGrp CARGO aRow<br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">next</span><br /> ENDTREE<br /><br /> oTree:<span style="color: #000000;">OpenAll</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> oTree<br /> </div>[/code:151gqnqd][/quote:151gqnqd]
Hi
I have a tree of two levels (MariaDb's objetc)
I need to evaluate if the 2nd Level is open.
If open, Then I take an action.
Only when double click on 2nd Level
How I do it?
Thanks
|
An easy way to make a tree-browse
|
You can trigger an action on double click with the codeblock
[code=fw:6p5o9g93]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCol:<span style="color: #000000;">bLDClickData</span> := <span style="color: #000000;">{</span> |r,c,f,col| someaction<span style="color: #000000;">(</span> r,c,f,col <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> </div>[/code:6p5o9g93]
Inside the function, check for
[code=fw:6p5o9g93]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">if</span> oCol:<span style="color: #000000;">oBrw</span>:<span style="color: #000000;">oTreeItem</span>:<span style="color: #000000;">nLevel</span> == <span style="color: #000000;">2</span><br /> <span style="color: #B900B9;">// action</span><br /><span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> </div>[/code:6p5o9g93]
|
An easy way to make a tree-browse
|
Good Morning (for me)
Many Thanks Mr. Rao!
I looked at in TxBrowse, TXBrwColumn and TLinkList class and not find <!-- s:o --><img src="{SMILIES_PATH}/icon_surprised.gif" alt=":o" title="Surprised" /><!-- s:o -->Brw:oTreeItem. Where is it?
|
An easy way to make a tree-browse
|
XBrowse has DATA oTreeItem
|
An easy way to make a tree-browse
|
Thanks again.
I looked in [url:puneg4fa]http://wiki.fivetechsoft.com/doku.php?id=fivewin_clase_txbrowse[/url:puneg4fa]
|
An easy way to make a tree-browse
|
Hello Mr Rao
I'm using a Tree and it's good
I'm using the same oTree:MakeTree() that your sample
but when i send oTree:CollapseAll()
it collapse the app
Error occurred at: 20/11/2019, 19:37:33
Error description: Error BASE/1004 Message not found: TLINKLIST:COLLAPSEALL
Args:
[ 1] = O TLINKLIST
Stack Calls
===========
Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TLINKLIST:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TLINKLIST:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TLINKLIST:COLLAPSEALL( 0 )
Called from: D:\Fuen32\FeHot\Source\FeH_TGes.prg => (b)TGESTION_RESERVAS( 115 )
what is wrong?
|
An easy way to make a tree-browse
|
[quote="MarioG":23wsw8ne]Hello Mr Rao
I'm using a Tree and it's good
I'm using the same oTree:MakeTree() that your sample
but when i send oTree:CollapseAll()
it collapse the app
Error occurred at: 20/11/2019, 19:37:33
Error description: Error BASE/1004 Message not found: TLINKLIST:COLLAPSEALL
Args:
[ 1] = O TLINKLIST
Stack Calls
===========
Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TLINKLIST:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TLINKLIST:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TLINKLIST:COLLAPSEALL( 0 )
Called from: D:\Fuen32\FeHot\Source\FeH_TGes.prg => (b)TGESTION_RESERVAS( 115 )
what is wrong?[/quote:23wsw8ne]
Sorry Mr. Rao
I 'm seeing in the source; and not exist a Method CollapseAll()
|
An easy way to make a tree-browse
|
[quote:2bsn2x5p]but when i send oTree:CollapseAll()
[/quote:2bsn2x5p]
There is no CollapseAll() method.
Use oTree:Collapse()
|
An easy way to make a tree-browse
|
Many Thanks Mr. Rao
|
An example of TAnimate Class
|
Dear friends:
Where can I found an example of TAnimate class ?.
Thanks a lot, Armando
|
An example of TAnimate Class
|
Hello, Armando
You can find it Samples\Win32.prg or Samples\Win32_.prg
Very easy. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Regards,
Richard
<!-- m --><a class="postlink" href="http://www.fivetech.com.tw/">http://www.fivetech.com.tw/</a><!-- m -->
|
An example of TAnimate Class
|
Richard:
Thank you very much, I was looking for as TAnimate.Prg
Best Regards, Armando
|
An example of TAnimate Class
|
Hello, Armando
You're Welcome!! <!-- s:P --><img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" /><!-- s:P -->
Regards,
Richard
|
An example of multithreading and Database
|
Hi,
Does anyone have an example of using WorkAreas and MT?
|
An example of multithreading and Database
|
<!-- m --><a class="postlink" href="https://docs.google.com/document/d/1xxRphZ5TIGbn5rOWQ_35VVcw8Yex63A4MKXimfq0MVg/edit#">https://docs.google.com/document/d/1xxR ... 0MVg/edit#</a><!-- m -->
Example multiThread index.
I want it noticed that it is possible to use MultiThread in index, but, in practice, in most cases it won't cause speed up because the bottleneck is not the CPU.
So read for better understanding of MultiThread
[code=fw:wr0y5xcm]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">/*<br /> Example multiThreads index.<br /> One thread by table , and one thread by index.<br /> 2010 Rafa Carmona<br /><br /> Thread Main<br /> |---------> Thhread child table for test.dbf<br /> | |----> Thread child index fname<br /> | |<br /> | |----->Thread child index fcode<br /> |<br /> |---------> Thhread child table for test2.dbf<br /> |----->Thread child index fname2<br /><br /><br /> */</span><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"hbthread.ch"</span><br /><br />proc Main<span style="color: #000000;">(</span> uCreate <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> nSeconds<br /> <span style="color: #00C800;">Local</span> aFiles := <span style="color: #000000;">{</span> <span style="color: #ff0000;">"test"</span>, <span style="color: #ff0000;">"test2"</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// Arrays files dbf</span><br /> <span style="color: #00C800;">Local</span> aNtx := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"fname"</span>, <span style="color: #ff0000;">"fcode"</span> <span style="color: #000000;">}</span>,; <span style="color: #B900B9;">// files index for test</span><br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"fName2"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// files index for test2</span><br /> <span style="color: #00C800;">Local</span> aExpr := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"name"</span>, <span style="color: #ff0000;">"code"</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"dtos(fecha)+str(code)"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #B900B9;">// Expresions</span><br /> <span style="color: #00C800;">Local</span> cDbf<br /><br /> <span style="color: #00C800;">if</span> empty<span style="color: #000000;">(</span> lCreate <span style="color: #000000;">)</span><br /> lCreate := <span style="color: #ff0000;">"0"</span><br /> <span style="color: #00C800;">endif</span><br /><br /> setmode<span style="color: #000000;">(</span> <span style="color: #000000;">25</span>,<span style="color: #000000;">80</span> <span style="color: #000000;">)</span><br /> cls<br /><br /> <span style="color: #00C800;">if</span> uCreate = <span style="color: #ff0000;">"1"</span><br /> ? <span style="color: #ff0000;">"Create test.dbf and test2.dbf"</span><br /> dbCreate<span style="color: #000000;">(</span><span style="color: #ff0000;">"test"</span>,<span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"name"</span>,<span style="color: #ff0000;">"C"</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"code"</span>,<span style="color: #ff0000;">"N"</span>,<span style="color: #000000;">7</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> use test<br /> <span style="color: #00C800;">while</span> lastRec<span style="color: #000000;">(</span><span style="color: #000000;">)</span> < <span style="color: #000000;">1000000</span><br /> dbAppend<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> field->name := chr<span style="color: #000000;">(</span> recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> field->code := recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">enddo</span><br /> close<br /> dbCreate<span style="color: #000000;">(</span><span style="color: #ff0000;">"test2"</span>,<span style="color: #000000;">{</span> <span style="color: #000000;">{</span><span style="color: #ff0000;">"fecha"</span>,<span style="color: #ff0000;">"D"</span>,<span style="color: #000000;">8</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,<span style="color: #000000;">{</span><span style="color: #ff0000;">"code"</span>,<span style="color: #ff0000;">"N"</span>,<span style="color: #000000;">7</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> use test2<br /> <span style="color: #00C800;">while</span> lastRec<span style="color: #000000;">(</span><span style="color: #000000;">)</span> < <span style="color: #000000;">1000000</span><br /> dbAppend<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> field->fecha := date<span style="color: #000000;">(</span><span style="color: #000000;">)</span> + recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> field->code := recno<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">enddo</span><br /> close<br /> <span style="color: #00C800;">endif</span><br /><br /> cls<br /> <span style="color: #B900B9;">// Threads</span><br /> nSeconds := Seconds<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">for</span> each cDbf in aFiles<br /> ? <span style="color: #ff0000;">"Process.: "</span> + cDbf<br /> hb_threadStart<span style="color: #000000;">(</span> @aCreateIndexe<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, cDbf, aNtx<span style="color: #000000;">[</span> cDbf:__enumindex <span style="color: #000000;">]</span>,aExpr<span style="color: #000000;">[</span> cDbf:__enumindex <span style="color: #000000;">]</span>, cDbf:__enumindex <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">next</span><br /><br /> ? <span style="color: #ff0000;">"Wait for threads ...."</span><br /> hb_threadWaitForAll<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ? hb_valTostr<span style="color: #000000;">(</span> Seconds<span style="color: #000000;">(</span><span style="color: #000000;">)</span> - nSeconds <span style="color: #000000;">)</span><br /><br /> ? <span style="color: #ff0000;">"finish"</span><br /><br /><span style="color: #00C800;">return</span><br /><br /><span style="color: #00C800;">function</span> aCreateIndexe<span style="color: #000000;">(</span> cFile, aNtx, aExpr, nPosDbf <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> nContador := <span style="color: #000000;">1</span><br /> <span style="color: #00C800;">Local</span> cFileNtx, cExpr<br /> <span style="color: #00C800;">Local</span> nLong := Len<span style="color: #000000;">(</span> aNtx <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> aThreads := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">Local</span> cAlias<br /><br /> use <span style="color: #000000;">(</span> cFile <span style="color: #000000;">)</span><br /> cAlias := <span style="color: #0000ff;">alias</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> hb_dbDetach<span style="color: #000000;">(</span> cAlias <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Libero el alias</span><br /><br /> <span style="color: #00C800;">for</span> each cFileNtx in aNtx<br /> cExpr := aExpr<span style="color: #000000;">[</span> cFileNtx:__enumindex <span style="color: #000000;">]</span><br /> nContador := <span style="color: #000000;">1</span><br /> nPos := cFileNtx:__enumindex<br /> aadd<span style="color: #000000;">(</span> aThreads, hb_threadStart<span style="color: #000000;">(</span> @crea<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, cAlias,cExpr, cFileNtx, nPos, nPosDbf <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">next</span><br /><br /> aEval<span style="color: #000000;">(</span> aThreads, <span style="color: #000000;">{</span> |x| hb_threadJoin<span style="color: #000000;">(</span> x <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// wait threads childs</span><br /> hb_dbRequest<span style="color: #000000;">(</span> cAlias, , , .T.<span style="color: #000000;">)</span> <span style="color: #B900B9;">// Restaura el alias</span><br /> close<br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br />proc crea<span style="color: #000000;">(</span> cAlias, cExpr, cFileNtx, nPos, nPosDbf <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> nContador := <span style="color: #000000;">1</span><br /><br /> hb_dbRequest<span style="color: #000000;">(</span> cAlias, , , .T.<span style="color: #000000;">)</span> <span style="color: #B900B9;">// Restaura el alias</span><br /><br /> <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> &<span style="color: #000000;">(</span>cExpr<span style="color: #000000;">)</span> <span style="color: #0000ff;">TO</span> &<span style="color: #000000;">(</span>cFileNtx<span style="color: #000000;">)</span> ;<br /> EVAL <span style="color: #000000;">{</span>|| hb_dispOutAt<span style="color: #000000;">(</span> nPosDbf, iif<span style="color: #000000;">(</span> nPos = <span style="color: #000000;">1</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">40</span> <span style="color: #000000;">)</span>,alltrim<span style="color: #000000;">(</span> hb_valtostr<span style="color: #000000;">(</span> nContador<span style="color: #000000;">)</span> <span style="color: #000000;">)</span>, <span style="color: #ff0000;">"GR+/N"</span> <span style="color: #000000;">)</span>, nContador += INT<span style="color: #000000;">(</span>LASTREC<span style="color: #000000;">(</span><span style="color: #000000;">)</span> / <span style="color: #000000;">100</span> <span style="color: #000000;">)</span> , .T. <span style="color: #000000;">}</span> ;<br /> EVERY INT<span style="color: #000000;">(</span> LASTREC<span style="color: #000000;">(</span><span style="color: #000000;">)</span> / <span style="color: #000000;">100</span> <span style="color: #000000;">)</span><br /> hb_dbDetach<span style="color: #000000;">(</span> cAlias <span style="color: #000000;">)</span> <span style="color: #B900B9;">// Libera el alias</span><br /><br /><span style="color: #00C800;">return</span><br /> </div>[/code:wr0y5xcm]
|
An example of multithreading and Database
|
Un ejemplo muy bueno que habrá que guardar como "oro en paño"
Gracias Rafa
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.