Public var in Get

Post Reply
ask
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Public var in Get

Post by ask »

I have a dialog inside a dialog but the gets have the same name (MUST be public) .How can i restore the one get when i release the variable from the get with the same name ?

The bellow sample shows the problem i'am facing .Can anyone tell me how to do it?


Sample:

#include "fivewin.ch"


function main()
local oDlg,oget,obtn
public nn:=0

define dialog odlg ;
from 0,0 to 200,300 pixel

@ 10,10 get oGet var nn of odlg ;
size 50,100 pixel

@ 0,0 button obtn action tt() pixel

activate dialog odlg

return ""




function tt()
local odlg,oget

public nn:="sdfdsf"

define dialog odlg ;
from 10,30 to 200,300 pixel

@ 10,10 get oGet var nn of odlg ;
size 50,100 pixel

activate dialog odlg
release nn
return ""


function tt2(oo,pp)

public &oo:=pp
return ""
ask
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Re: Public var in Get

Post by ask »

EnricoMaria wrote:Use PRIVATE instead of PUBLIC.

EMG
thanks Enrico but i put wrong sample .Consider that i want to initialize the variables within another function and get them from another function .The bellow shows the error:


#include "fivewin.ch"


function main()
local oDlg,oget,obtn

initv1()

define dialog odlg ;
from 0,0 to 200,300 pixel

@ 10,10 get oGet var nn of odlg ;
size 50,100 pixel

@ 0,0 button obtn action tt() pixel
@ 0,120 button obtn action tt2("nn",oDlg:acontrols[1]:value()) pixel

activate dialog odlg

return ""



function initv1()
public nn:=0
return ""


function initv2()
public nn:="test"
return ""




function tt()
local odlg,oget

initv2()
define dialog odlg ;
from 10,30 to 200,300 pixel

@ 10,10 get oGet var nn of odlg ;
size 50,100 pixel

activate dialog odlg
release nn
return ""
ask
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Re: Public var in Get

Post by ask »

EnricoMaria wrote:Sorry, I don't understand your sample. Try using LOCALs.

EMG
Imagine that you open a dbf and assign the fields to public variables(fitrst function), then draw the dialog with the gets (second function) and get the values of the variables at the end of dialog (third function). BUT inside the dialog i have a nested dialog with the same structure (function first,second,third).That is why i have to use public variables and that it why i have the problem when i release variables that exists in another dialog.
Post Reply