PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Object naming and lifespan?
Object naming and lifespan?
Iniciado por BigED, 11,jun. 2017 11:02 - 3 respuestas
Miembro registrado
14 mensajes
Publicado el 11,junio 2017 - 11:02
From WinDEV Manual: "The object is created during its declaration. The object is local by default."

I have two Windows, Win1 and Win2 and declared Class MyClass

//Win1
//Global declaration Win1
gclTest is MyClass

//after processing click BTN_New to open Win2
Open(Win2)


//Win2
//Global declaration Win2
gclTest is MyClass

//after processing return to Win1
RETURN


After returning to first window the class gclTest is destroyed.
If I use different name, everything is OK.

So, how it is possible if object is local by default, as manual say?

Any clue?
Publicado el 12,junio 2017 - 14:50
Hi Ed,

it is local by default.
If you declare it in the GLOBAL declarations of the windows, then of
course it is GLOBAL (as the name of the area specifies)

If you want it local, then use the LOCAL keyword.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 6/11/2017 à 3:02 AM, BigED a écrit :
From WinDEV Manual: "The object is created during its declaration. The
object is local by default."

I have two Windows, Win1 and Win2 and declared Class MyClass

//Win1
//Global declaration Win1
gclTest is MyClass

//after processing click BTN_New to open Win2
Open(Win2)


//Win2
//Global declaration Win2
gclTest is MyClass

//after processing return to Win1
RETURN


After returning to first window the class gclTest is destroyed.
If I use different name, everything is OK.

So, how it is possible if object is local by default, as manual say?

Any clue?
Path: news.pcsoft.fr!not-for-mail
From: "BigED" <priv!24v8+43I0E3Z43I0E3+A4GM0r95+2p51s6@news.pcsoft>
Newsgroups: pcsoft.us.windev
Message-ID: <20174422ef668d8b4106abbc2ac1fe319667@news.pcsoft.fr>
Date: Sun, 11 Jun 2017 09:02:16 +0200
Subject: Object naming and lifespan?
NNTP-Posting-Host: 5.39.139.109
X-Server-Date: Sun, 11 Jun 2017 09:02:16 +0200
Xref: news.pcsoft.fr pcsoft.us.windev:61241
: bytes: 583
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
X-Authenticated-User: Y
X-Complaints-To: <info@psoft.fr>
X-No-Archive: Yes
Approved: <moderateur@pcsoft.fr>

From WinDEV Manual: "The object is created during its declaration. The
object is local by default."

I have two Windows, Win1 and Win2 and declared Class MyClass

//Win1
//Global declaration Win1
gclTest is MyClass

//after processing click BTN_New to open Win2
Open(Win2)


//Win2
//Global declaration Win2
gclTest is MyClass

//after processing return to Win1
RETURN


After returning to first window the class gclTest is destroyed.
If I use different name, everything is OK.

So, how it is possible if object is local by default, as manual say?

Any clue?
Miembro registrado
14 mensajes
Publicado el 12,junio 2017 - 16:51
Hm..

It's GLOBAL just for the WINDOW, like any other variable. Isn't it?

If declared as LOCAL than this object is unaccesible in all controls in that window.
Publicado el 12,junio 2017 - 17:11
Hi,

You are right, and I have been using that technique for years, with the
same object name declared in separate windows (I'm using that with my
clLog class, to trace all opening and closing of windows in complex UIs)

Now, there are different options available in the project settings
regarding the scope of variables and objects, so your problem may be
coming from one of these settings.

Best regards


--
Fabrice Harari
Consultant WinDev, WebDev et WinDev Mobile International

A votre disposition : WXShowroom.com, WXReplication (open source) et
maintenant WXEDM (open source)

Plus d'information sur http://fabriceharari.com


Le 6/12/2017 à 8:51 AM, BigED a écrit :
Hm..

It's GLOBAL just for the WINDOW, like any other variable. Isn't it?

If declared as LOCAL than this object is unaccesible in all controls in
that window.