Page 1 of 2

check on get

PostPosted: Fri Nov 24, 2023 2:55 pm
by Silvio.Falconi
I would like to check if any get is modified during editing, if it is modified the procedure must ask the user to save or not

when the user presses "Exit" I wanted to check if the gets have been modified

I made

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

Function test()
local aGet:=array(2)
local oDlg
local cGet1:=space(60)
local cGet2:=space(60)
local lSave:=.f.
local bCheck
local oBtn1,oBtn2

DEFINE DIALOG oDLG SIZE 400,200

@ 10,10 GET aGet[1] VAR cGet1 SIZE 100,10 PIXEL of oDlg
@ 40,10 GET aGet[2] VAR cGet2 SIZE 100,10 PIXEL of oDlg

 @  90,  55  BUTTON oBtn1 Prompt "&OK" SIZE  45,  10 PIXEL  OF oDlg ACTION  ( oDlg:end( IDOK ) )
 @  90,  107 BUTTON oBtn2  Prompt "&EXIT"  SIZE  45,  10 PIXEL  OF oDlg ACTION ( oDlg:end( IDCANCEL ) )
       *  
bCheck:= { || lSave:= IIF(Msgyesno("I must save ?"),.t.,.f.), oDLG:AEvalWhen(), .t. }

AEval( aGet, { |o| o:bChange :=  bCheck } )

ACTIVATE DIALOG oDLG CENTER ON INIT EVAL(bCheck)

IF lSave
//---- save
Endif
return nil

 


I made also

AEval(aGet,{|oGet| oGet:bChange:={||lSave:= IIF(Msgyesno("I must save ?"),.t.,.f.)}})

but not run ok,How I can resolve ?

Re: check on get

PostPosted: Fri Nov 24, 2023 3:47 pm
by Marc Venken
There will be better ways, but i would think of making the aGet 2 dimensional and fill the second part with the original data.
After edit you could simple check the values for differences in the aGet

Re: check on get

PostPosted: Fri Nov 24, 2023 3:52 pm
by karinha
yo haria asi:

Code: Select all  Expand view

// C:\FWH\SAMPLES\SILVICHK.PRG

#include "FiveWin.ch"

STATIC lSave := .F.

FUNCTION Main()

   LOCAL aGet := ARRAY( 2 )
   LOCAL oDlg
   LOCAL cGet1 := SPACE( 60 )
   LOCAL cGet2 := SPACE( 60 )
   LOCAL bCheck
   LOCAL oBtn1, oBtn2

   DEFINE DIALOG oDlg SIZE 400, 200

   @ 10,  10 GET aGet[ 1 ] VAR cGet1 SIZE 100, 10 PIXEL OF oDlg

   @ 40,  10 GET aGet[ 2 ] VAR cGet2 SIZE 100, 10 PIXEL OF oDlg

   @ 90,  55 BUTTON oBtn1 PROMPT "&OK" SIZE 45, 10 PIXEL OF oDlg ;
      ACTION ( lSave := .T., oDlg:End() )  // IDOK ?? .RC? NO COMPRENDO ESTO

   @ 90, 107 BUTTON oBtn2  PROMPT "&EXIT" SIZE 45, 10 PIXEL OF oDlg ;
      ACTION ( lSave := .F., oDlg:End() ) CANCEL // IDCANCEL // ??

   // bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:AEvalWhen(), .T. }

   // bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:End(), .T. }

   // AEval( aGet, {| o | o:bChange :=  bCheck } )

   ACTIVATE DIALOG oDlg CENTER // ON INIT Eval( bCheck )

   IF lSave

      // ---- save
      ? "Grabar? ", lSave  // .T.

      // Graba_Todo()

   ENDIF

   lSave := .F.  // al salir.

RETURN NIL
// FIN / END
 


Regards, saludos.

Re: check on get

PostPosted: Fri Nov 24, 2023 4:52 pm
by nageswaragunupudi
FWH provides a way for the last many years.

if oGet:lChanged is true, the value is edited and modified.
We can also check the original value with oGet:uOriginalValue.

Re: check on get

PostPosted: Sat Nov 25, 2023 2:26 pm
by karinha
nageswaragunupudi wrote:FWH provides a way for the last many years.

if oGet:lChanged is true, the value is edited and modified.
We can also check the original value with oGet:uOriginalValue.


Mister Rao:

https://forums.fivetechsupport.com/viewtopic.php?f=3&t=36677&p=218742&hilit=oGet%3AuOriginalValue&sid=07c886246d7ffe73fed662e55bd3cb86&sid=c321ec65cbe0a0b68df11d3cba5138d3#p218742

Master Rao:

Sorry for the stupidity, but I've never seen anything like this working. Do you have any practical example of using these commands?

Perdón por la estupidez, pero nunca había visto algo así funcionando. ¿Tiene algún ejemplo práctico del uso de estos comandos?

Gracias, thanks.

Regards, saludos.

Re: check on get

PostPosted: Sat Nov 25, 2023 3:38 pm
by Silvio.Falconi
Nages,
I'm making a complex but simple procedure to be able to use it even for those who don't have the latest version of fwh, it's a utility that I started a long time ago and then left because I was hoping for other procedures started by certain people who then didn't have having completed the work and now I see it quicker and at the same time powerful to use this type of procedure, even if it is ancient, to enhance some of the aspects necessary for those who program with fwh, in the future it could also be used for those who want to create procedures for web because if you want you can convert it for the web.

Re: check on get

PostPosted: Mon Nov 27, 2023 10:05 am
by Silvio.Falconi
karinha wrote:yo haria asi:

Code: Select all  Expand view

// C:\FWH\SAMPLES\SILVICHK.PRG

#include "FiveWin.ch"

STATIC lSave := .F.

FUNCTION Main()

   LOCAL aGet := ARRAY( 2 )
   LOCAL oDlg
   LOCAL cGet1 := SPACE( 60 )
   LOCAL cGet2 := SPACE( 60 )
   LOCAL bCheck
   LOCAL oBtn1, oBtn2

   DEFINE DIALOG oDlg SIZE 400, 200

   @ 10,  10 GET aGet[ 1 ] VAR cGet1 SIZE 100, 10 PIXEL OF oDlg

   @ 40,  10 GET aGet[ 2 ] VAR cGet2 SIZE 100, 10 PIXEL OF oDlg

   @ 90,  55 BUTTON oBtn1 PROMPT "&OK" SIZE 45, 10 PIXEL OF oDlg ;
      ACTION ( lSave := .T., oDlg:End() )  // IDOK ?? .RC? NO COMPRENDO ESTO

   @ 90, 107 BUTTON oBtn2  PROMPT "&EXIT" SIZE 45, 10 PIXEL OF oDlg ;
      ACTION ( lSave := .F., oDlg:End() ) CANCEL // IDCANCEL // ??

   // bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:AEvalWhen(), .T. }

   // bCheck := {|| lSave := iif( Msgyesno( "I must save ?" ), .T., .F. ), oDlg:End(), .T. }

   // AEval( aGet, {| o | o:bChange :=  bCheck } )

   ACTIVATE DIALOG oDlg CENTER // ON INIT Eval( bCheck )

   IF lSave

      // ---- save
      ? "Grabar? ", lSave  // .T.

      // Graba_Todo()

   ENDIF

   lSave := .F.  // al salir.

RETURN NIL
// FIN / END
 


Regards, saludos.



Karinha,
what do you mean by "NO COMPRENDO ESTO" ?

Code: Select all  Expand view

DEFINE DIALOG oDlg
 @  80,  55  BUTTON oBtn1 Prompt "&OK" SIZE  45,  10 PIXEL  OF oDlg ACTION  ( oDlg:end( IDOK ) )
 @  80,  107 BUTTON oBtn2  Prompt "&EXIT"  SIZE  45,  10 PIXEL  OF oDlg ACTION  (oDlg:end( IDCANCEL ) )
ACTIVATE DIALOG oDlg

IF  oDlg:nresult == IDOK
     Msginfo()
Endif


what is difficult?
bother variable of the type "lsave:= .t. or lsave:= .f." It's just for kids, it seems like you're still programming with the clipper

Re: check on get

PostPosted: Mon Nov 27, 2023 10:07 am
by Silvio.Falconi
nageswaragunupudi wrote:FWH provides a way for the last many years.

if oGet:lChanged is true, the value is edited and modified.
We can also check the original value with oGet:uOriginalValue.



Nages,
I not understood
I tried to found the result of oGet:lchanged and give me no exist

Code: Select all  Expand view
Error occurred at: 27-11-2023, 11:06:45
   Error description: Error BASE/1004  Metodo non disponibile: LCHANGED
   Args:
     [   1] = U  


Code: Select all  Expand view
AEval(aGet,{|oGet| IIF( oGet:lChanged, lSave:= IIF(Msgyesno("I must save ?"),.t.,.f.),) , oDLG:AEvalWhen(), .t. })
 

Re: check on get

PostPosted: Mon Nov 27, 2023 10:14 am
by nageswaragunupudi
I tried to found the result of oGet:lchanged and give me no exist

Code:
Error occurred at: 27-11-2023, 11:06:45
Error description: Error BASE/1004 Metodo non disponibile: LCHANGED
Args:
[ 1] = U

This error means that oGet is NIL

Re: check on get

PostPosted: Mon Nov 27, 2023 10:22 am
by Silvio.Falconi
nageswaragunupudi wrote:
I tried to found the result of oGet:lchanged and give me no exist

Code:
Error occurred at: 27-11-2023, 11:06:45
Error description: Error BASE/1004 Metodo non disponibile: LCHANGED
Args:
[ 1] = U

This error means that oGet is NIL


Can you make a sample with lChanged pls ?

Re: check on get

PostPosted: Wed Nov 29, 2023 5:11 pm
by karinha
what is difficult?
bother variable of the type "lsave:= .t. or lsave:= .f." It's just for kids, it seems like you're still programming with the clipper


Silvio, I learned to program in CLIPPER 5.3 and I continue to use the CLIPPER 5.3 modus operandi to this day. And I don't want to program in the way you program even in the next incarnation. I prefer programming for children. The day I program the way you program or treat people, I'd rather retire.

Silvio, aprendí a programar en CLIPPER 5.3 y sigo usando el modus operandi de CLIPPER 5.3 hasta el día de hoy. Y no quiero programar de la forma en que ustedes programan ni siquiera en la próxima encarnación. Prefiero la programación para niños. El día que programe la forma en que usted programa o trata a las personas, preferiría retirarme

Regards, saludos.

Re: check on get

PostPosted: Wed Nov 29, 2023 6:20 pm
by Silvio.Falconi
Dear sir, I started a long time before you, with the Autumn 86 version of the Nuntucket Clipper, then I moved on to the Summer 87 version, that is, many years before the Clipper became Ca-Associates who killed the clipper with version 5.3, then we moved on to Clip4win, tried Alaska, and then Harry Evans, an Austrian from Momos clipper magazine in Bolzano, sold us the first version of the fivewin libraries version 1.44, then I purchased the Fw 19.5 version from Linares and so on up to the present day all or almost all versions purchased from Linares.


Every time I ask for help I should change the code to make you happy and I never find the answer to the requested question, I only get help when the fwteam or some other good person answers me, still today I can't understand why you, dear sir, are a moderator of the forum

Re: check on get

PostPosted: Wed Nov 29, 2023 6:28 pm
by karinha
Silvio.Falconi wrote:Dear sir, I started a long time before you, with the Autumn 86 version of the Nuntucket Clipper, then I moved on to the Summer 87 version, that is, many years before the Clipper became Ca-Associates who killed the clipper with version 5.3, then we moved on to Clip4win, tried Alaska, and then Harry Evans, an Austrian from Momos clipper magazine in Bolzano, sold us the first version of the fivewin libraries version 1.44, then I purchased the Fw 19.5 version from Linares and so on up to the present day all or almost all versions purchased from Linares.


Every time I ask for help I should change the code to make you happy and I never find the answer to the requested question, I only get help when the fwteam or some other good person answers me, still today I can't understand why you, dear sir, are a moderator of the forum


Silvio, I am a moderator precisely because of people like you. Arrogant, rude, and other predicates that I will not mention here, as my education does not allow it. And I have no problem if Master Linãres takes away my powers, I will face you as MODERATOR or not. My duty is to fight BAD people like you.

Silvio, soy moderador precisamente por gente como tú. Arrogante, grosero y otros predicados que no mencionaré aquí, ya que mi educación no me lo permite. Y no tengo ningún problema si el Maestro Linãres me quita los poderes, te enfrentaré como MODERADOR o no. Mi deber es luchar contra la gente MALA como tú.

Regards, saludos.

Re: check on get

PostPosted: Wed Nov 29, 2023 6:58 pm
by Otto
Dear João,
Did you know that in our FW-samples we have a program called moon.prg?

It calculates the phases of the full moon.
I've been conducting an empirical study for many years on people's behavior during the full moon. In the company, we send out warning emails,
as people in support become extremely unpleasantly demanding during this time.

The last full moon in 2023 was on November 26th.

Unfortunately, I discovered this connection too late in life. Many things are easier in dealing with people when you are aware of this.

Don't take posts too seriously during this time and don't get drawn into arguments.

Thank you for your valuable work here in the forum.

Best regards,
Otto

Re: check on get

PostPosted: Wed Nov 29, 2023 7:53 pm
by karinha
Master Otto, I thank you for the advice. I'm a calm and peaceful person, but I don't have cockroach blood. I apologize if I hurt anyone in any way. Silvio Falconi has the gift of blowing anyone away, in any phase of the moon. hahahahahaha, 1000 apologies mister Otto.

Maestro Otto, le agradezco el consejo. Soy una persona tranquila y pacífica, pero no tengo sangre de cucaracha. Pido disculpas si lastimé a alguien de alguna manera. Silvio Falconi tiene el don de dejar boquiabierto a cualquiera, en cualquier fase de la luna. jajajajajaja, 1000 disculpas señor Otto.


Regards, saludos.