In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Saving and restoring values of all controls on a form
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
Hi,
I want to save (and restore) all values of all the controls on a form. I
already know how to catch the controls objects (explained in a previous
thread by Jose), but I need to know the names given by me to the controls.
(Jose allready explainted how to catch the values). I tried with
aControl:cVarName, but this raises an error. Strange, because cVarName is a
property that is present in the object browser.
Cheers,
Stephan
I want to save (and restore) all values of all the controls on a form. I
already know how to catch the controls objects (explained in a previous
thread by Jose), but I need to know the names given by me to the controls.
(Jose allready explainted how to catch the values). I tried with
aControl:cVarName, but this raises an error. Strange, because cVarName is a
property that is present in the object browser.
Cheers,
Stephan
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
I have solved the problem myself by taking the numerical position of the
controls. It works as long as you don't add, delete, or change position of
the controls.
It's not worked out for all type of controls, but it's easy to extend.
Cheers,
Stephan
//---------------------------------------------------------- --------------------
METHOD ReadIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL cValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
aControls[n]:Value := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TComboBox"
aControls[n]:cText := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TRadioMenu"
aControls[n]:nIndex := Val(oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")))
ELSEIF cClassName == "TCheckBox"
aControls[n]:lChecked := oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")) == "1"
ENDIF
NEXT nControl
END
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD SaveIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL uValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:Value)
ELSEIF cClassName == "TComboBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:cText)
ELSEIF cClassName == "TRadioMenu"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
Ltrim(Str(aControls[n]:nIndex)))
ELSEIF cClassName == "TCheckBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
IIF(aControls[n]:lChecked, "1", "0"))
ENDIF
NEXT nControl
:Commit()
END
RETURN Nil
//---------------------------------------------------------- --------------------
STATIC PROCEDURE GetControls(oParent, aControls)
LOCAL oCtl
IF oParent:IsKindOf( "TWinControl" )
FOR EACH oCtl IN oParent:aControls
Aadd( aControls, oCtl )
GetControls(oCtl, aControls)
NEXT
ENDIF
RETURN
"Stephan Hennekens" <stephan.hennekens@wur.nl> wrote in message
news:[email=46d02cb5@ozsrv2.ozlan.local...]46d02cb5@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is
> a property that is present in the object browser.
>
> Cheers,
> Stephan
>
controls. It works as long as you don't add, delete, or change position of
the controls.
It's not worked out for all type of controls, but it's easy to extend.
Cheers,
Stephan
//---------------------------------------------------------- --------------------
METHOD ReadIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL cValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
aControls[n]:Value := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TComboBox"
aControls[n]:cText := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TRadioMenu"
aControls[n]:nIndex := Val(oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")))
ELSEIF cClassName == "TCheckBox"
aControls[n]:lChecked := oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")) == "1"
ENDIF
NEXT nControl
END
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD SaveIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL uValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:Value)
ELSEIF cClassName == "TComboBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:cText)
ELSEIF cClassName == "TRadioMenu"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
Ltrim(Str(aControls[n]:nIndex)))
ELSEIF cClassName == "TCheckBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
IIF(aControls[n]:lChecked, "1", "0"))
ENDIF
NEXT nControl
:Commit()
END
RETURN Nil
//---------------------------------------------------------- --------------------
STATIC PROCEDURE GetControls(oParent, aControls)
LOCAL oCtl
IF oParent:IsKindOf( "TWinControl" )
FOR EACH oCtl IN oParent:aControls
Aadd( aControls, oCtl )
GetControls(oCtl, aControls)
NEXT
ENDIF
RETURN
"Stephan Hennekens" <stephan.hennekens@wur.nl> wrote in message
news:[email=46d02cb5@ozsrv2.ozlan.local...]46d02cb5@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is
> a property that is present in the object browser.
>
> Cheers,
> Stephan
>
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
I have solved the problem myself by taking the numerical position of the
controls. It works as long as you don't add, delete, or change position of
the controls.
It's not worked out for all type of controls, but it's easy to extend.
Cheers,
Stephan
//---------------------------------------------------------- --------------------
METHOD ReadIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL cValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
aControls[n]:Value := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TComboBox"
aControls[n]:cText := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TRadioMenu"
aControls[n]:nIndex := Val(oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")))
ELSEIF cClassName == "TCheckBox"
aControls[n]:lChecked := oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")) == "1"
ENDIF
NEXT nControl
END
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD SaveIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL uValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:Value)
ELSEIF cClassName == "TComboBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:cText)
ELSEIF cClassName == "TRadioMenu"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
Ltrim(Str(aControls[n]:nIndex)))
ELSEIF cClassName == "TCheckBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
IIF(aControls[n]:lChecked, "1", "0"))
ENDIF
NEXT nControl
:Commit()
END
RETURN Nil
//---------------------------------------------------------- --------------------
STATIC PROCEDURE GetControls(oParent, aControls)
LOCAL oCtl
IF oParent:IsKindOf( "TWinControl" )
FOR EACH oCtl IN oParent:aControls
Aadd( aControls, oCtl )
GetControls(oCtl, aControls)
NEXT
ENDIF
RETURN
"Stephan Hennekens" <stephan.hennekens@wur.nl> wrote in message
news:[email=46d02cb5@ozsrv2.ozlan.local...]46d02cb5@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is
> a property that is present in the object browser.
>
> Cheers,
> Stephan
>
controls. It works as long as you don't add, delete, or change position of
the controls.
It's not worked out for all type of controls, but it's easy to extend.
Cheers,
Stephan
//---------------------------------------------------------- --------------------
METHOD ReadIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL cValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
aControls[n]:Value := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TComboBox"
aControls[n]:cText := oIni:GetEntry("CONTROLS", PadL(n, 3, "0"))
ELSEIF cClassName == "TRadioMenu"
aControls[n]:nIndex := Val(oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")))
ELSEIF cClassName == "TCheckBox"
aControls[n]:lChecked := oIni:GetEntry("CONTROLS", PadL(n, 3,
"0")) == "1"
ENDIF
NEXT nControl
END
RETURN Nil
//---------------------------------------------------------- --------------------
METHOD SaveIni()
LOCAL oIni
LOCAL n, aControls := {}
LOCAL cClassName
LOCAL uValue
WITH OBJECT oIni := TIni():New()
:cFilename := StrTran(Lower(Application:cFilename), ".exe", ".ini")
GetControls(Self, aControls)
FOR n := 1 TO Len(aControls)
cClassName := aControls[n]:ClassName()
IF cClassName == "TEdit" .OR. cClassName == "TEditBtn"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:Value)
ELSEIF cClassName == "TComboBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"), aControls[n]:cText)
ELSEIF cClassName == "TRadioMenu"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
Ltrim(Str(aControls[n]:nIndex)))
ELSEIF cClassName == "TCheckBox"
:SetEntry("CONTROLS", PadL(n, 3, "0"),
IIF(aControls[n]:lChecked, "1", "0"))
ENDIF
NEXT nControl
:Commit()
END
RETURN Nil
//---------------------------------------------------------- --------------------
STATIC PROCEDURE GetControls(oParent, aControls)
LOCAL oCtl
IF oParent:IsKindOf( "TWinControl" )
FOR EACH oCtl IN oParent:aControls
Aadd( aControls, oCtl )
GetControls(oCtl, aControls)
NEXT
ENDIF
RETURN
"Stephan Hennekens" <stephan.hennekens@wur.nl> wrote in message
news:[email=46d02cb5@ozsrv2.ozlan.local...]46d02cb5@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is
> a property that is present in the object browser.
>
> Cheers,
> Stephan
>
Saving and restoring values of all controls on a form
Stephan,
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is a
> property that is present in the object browser.
That property exist only in the IDE at design time, so you can't access it
in runtime.
Regards,
José Lalín
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is a
> property that is present in the object browser.
That property exist only in the IDE at design time, so you can't access it
in runtime.
Regards,
José Lalín
Saving and restoring values of all controls on a form
Stephan,
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is a
> property that is present in the object browser.
That property exist only in the IDE at design time, so you can't access it
in runtime.
Regards,
José Lalín
> I want to save (and restore) all values of all the controls on a form. I
> already know how to catch the controls objects (explained in a previous
> thread by Jose), but I need to know the names given by me to the controls.
> (Jose allready explainted how to catch the values). I tried with
> aControl:cVarName, but this raises an error. Strange, because cVarName is a
> property that is present in the object browser.
That property exist only in the IDE at design time, so you can't access it
in runtime.
Regards,
José Lalín
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
Oke! But is there a way to retrieve the given name of a control?
"José Lalín" <notengo@correo.com> wrote in message
news:46d09276$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> I want to save (and restore) all values of all the controls on a form. I
>> already know how to catch the controls objects (explained in a previous
>> thread by Jose), but I need to know the names given by me to the
>> controls. (Jose allready explainted how to catch the values). I tried
>> with aControl:cVarName, but this raises an error. Strange, because
>> cVarName is a property that is present in the object browser.
>
> That property exist only in the IDE at design time, so you can't access it
> in runtime.
>
> Regards,
> José Lalín
"José Lalín" <notengo@correo.com> wrote in message
news:46d09276$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> I want to save (and restore) all values of all the controls on a form. I
>> already know how to catch the controls objects (explained in a previous
>> thread by Jose), but I need to know the names given by me to the
>> controls. (Jose allready explainted how to catch the values). I tried
>> with aControl:cVarName, but this raises an error. Strange, because
>> cVarName is a property that is present in the object browser.
>
> That property exist only in the IDE at design time, so you can't access it
> in runtime.
>
> Regards,
> José Lalín
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
Oke! But is there a way to retrieve the given name of a control?
"José Lalín" <notengo@correo.com> wrote in message
news:46d09276$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> I want to save (and restore) all values of all the controls on a form. I
>> already know how to catch the controls objects (explained in a previous
>> thread by Jose), but I need to know the names given by me to the
>> controls. (Jose allready explainted how to catch the values). I tried
>> with aControl:cVarName, but this raises an error. Strange, because
>> cVarName is a property that is present in the object browser.
>
> That property exist only in the IDE at design time, so you can't access it
> in runtime.
>
> Regards,
> José Lalín
"José Lalín" <notengo@correo.com> wrote in message
news:46d09276$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> I want to save (and restore) all values of all the controls on a form. I
>> already know how to catch the controls objects (explained in a previous
>> thread by Jose), but I need to know the names given by me to the
>> controls. (Jose allready explainted how to catch the values). I tried
>> with aControl:cVarName, but this raises an error. Strange, because
>> cVarName is a property that is present in the object browser.
>
> That property exist only in the IDE at design time, so you can't access it
> in runtime.
>
> Regards,
> José Lalín
Saving and restoring values of all controls on a form
Stephan,
> Oke! But is there a way to retrieve the given name of a control?
I'm afraid no.
Regards,
José Lalín
> Oke! But is there a way to retrieve the given name of a control?
I'm afraid no.
Regards,
José Lalín
Saving and restoring values of all controls on a form
Stephan,
> Oke! But is there a way to retrieve the given name of a control?
I'm afraid no.
Regards,
José Lalín
> Oke! But is there a way to retrieve the given name of a control?
I'm afraid no.
Regards,
José Lalín
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
Oke, thanks!
I works with the numerical position.
Regards,
Stephan
"José Lalín" <notengo@correo.com> wrote in message
news:46d1ecda$[email=2@ozsrv2.ozlan.local...]2@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> Oke! But is there a way to retrieve the given name of a control?
>
> I'm afraid no.
>
> Regards,
> José Lalín
I works with the numerical position.
Regards,
Stephan
"José Lalín" <notengo@correo.com> wrote in message
news:46d1ecda$[email=2@ozsrv2.ozlan.local...]2@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> Oke! But is there a way to retrieve the given name of a control?
>
> I'm afraid no.
>
> Regards,
> José Lalín
-
- Mensajes: 305
- Registrado: Jue Nov 30, 2006 12:17 am
Saving and restoring values of all controls on a form
Oke, thanks!
I works with the numerical position.
Regards,
Stephan
"José Lalín" <notengo@correo.com> wrote in message
news:46d1ecda$[email=2@ozsrv2.ozlan.local...]2@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> Oke! But is there a way to retrieve the given name of a control?
>
> I'm afraid no.
>
> Regards,
> José Lalín
I works with the numerical position.
Regards,
Stephan
"José Lalín" <notengo@correo.com> wrote in message
news:46d1ecda$[email=2@ozsrv2.ozlan.local...]2@ozsrv2.ozlan.local...[/email]
>
> Stephan,
>
>> Oke! But is there a way to retrieve the given name of a control?
>
> I'm afraid no.
>
> Regards,
> José Lalín