FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Public var in Get
Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM
Public var in Get
Posted: Mon Nov 14, 2005 12:17 PM
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 ""
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Public var in Get
Posted: Mon Nov 14, 2005 12:33 PM

Use PRIVATE instead of PUBLIC.

EMG

Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM
Re: Public var in Get
Posted: Mon Nov 14, 2005 12:49 PM
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 ""
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Public var in Get
Posted: Mon Nov 14, 2005 12:54 PM

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

EMG

Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM
Re: Public var in Get
Posted: Mon Nov 14, 2005 01:00 PM
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.

Continue the discussion