Public var in Get

Public var in Get

Postby ask » 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 ""
ask
 
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Re: Public var in Get

Postby Enrico Maria Giordano » Mon Nov 14, 2005 12:33 pm

Use PRIVATE instead of PUBLIC.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Public var in Get

Postby ask » 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 ""
ask
 
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am

Re: Public var in Get

Postby Enrico Maria Giordano » Mon Nov 14, 2005 12:54 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Public var in Get

Postby ask » Mon Nov 14, 2005 1: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.
ask
 
Posts: 99
Joined: Wed Nov 02, 2005 10:40 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 101 guests