Prev: Simple array of strings to COM
Next: Using SQL Master
From: Mario Schulz on 31 May 2010 04:50 Hi, as one part to solve my problems with 5333er i will get rid of any globals in my app.. so i put the MainWindow ( Shellwindow) as a Protect in my app object an declare an access to it.. in my source i use it as follows : METHOD TerminKunde() CLASS dw_Rechnungen LOCAL oApp AS conceptApp oApp := GetconceptApp() dw_Terminkalender_WV{oApp:MainWindow,,,{"KUNDE", SELF:Server:Kunde}}:Show() RETURN But if i understand the gc it kicks all unused locals sometimes... if the window "dw_terminkalender" still alive and the user lets say edid a long time in that window will the gc kicks the local oApp ?? And end again in a 5333er ? thanks for help, Mario
From: richard.townsendrose on 31 May 2010 05:05 Mario the best way to get hold of these is via the SysObject() in the shell window class EXPORT lDataCheckOk AS LOGIC // logging on in the shell window init() SysObject(SELF) // CAL 051001 then you just access your variables like this SysObject():lDataCheckOk:=FALSE but we go one step further we have user specific settings - like local directories, screen colors etc these are stored in an ini file - could be the registry we have Categories for things like names for forms these are stored in a table and of course we have parameters these are also stored in a table PROTECT UserSet AS AppIni PROTECT Categories AS Categories PROTECT Params AS Params so these are initailised and stored in an object, which are then accessed via a call to SYSOBJECT():GetParam(A_DEFINED_PARAMETER) easy and very extensible richard
From: Mathias on 31 May 2010 07:40 Hi Mario, the GC only collects objects that have no references pointing to them. The application object always has a reference pointing to it. The local variable (oApp) however goes out of scope when execution leaves this method. The App object continues to live and is not collected. Your sample looks a little bit strange howoever. Is oApp:MainWindow a StandardShellWindow? Who is the owner of dw_Rechnungen? StandardShellWindow? In that case you don't have to use the App object to get access to the shell window! Using self:owner would then be a much easier solution. /Mathias On 31 Maj, 10:50, Mario Schulz <i...(a)removethiswegenspamconcept-dv.de> wrote: > Hi, > > as one part to solve my problems with 5333er i will get rid of any > globals in my app.. so i put the MainWindow ( Shellwindow) as a Protect > in my app object an declare an access to it.. in my source i use it as > follows : > > METHOD TerminKunde() CLASS dw_Rechnungen > LOCAL oApp AS conceptApp > > oApp := GetconceptApp() > > dw_Terminkalender_WV{oApp:MainWindow,,,{"KUNDE", > SELF:Server:Kunde}}:Show() > RETURN > > But if i understand the gc it kicks all unused locals sometimes... if > the window "dw_terminkalender" still alive and the user lets say edid a > long time in that window will the gc kicks the local oApp ?? And end > again in a 5333er ? > > thanks for help, > > Mario
From: Carlos Rocha on 31 May 2010 11:55 Hi Mario, I recently had a deep issue with 5333 and nothing seemed to work. The 5333 happens when the program tries to access something that doesn't exist, and in my case was in a class wrapper for a COM object, where I added an export to refer another COM object, like in class oMyCom as MyCom export oCom as IAnotherCom method Init(oOwner) class MyCom super:Init(oOwner) oCom := self:AnotherCom return self This was done for speed reasons. The solution is to declare oCom as a local when it is needed. No more 5333 now. Hope this hepls > Hi, > > as one part to solve my problems with 5333er i will get rid of any > globals in my app.. so i put the MainWindow ( Shellwindow) as a > Protect in my app object an declare an access to it.. in my source i > use it as follows : > > METHOD TerminKunde() CLASS dw_Rechnungen > LOCAL oApp AS conceptApp > > oApp := GetconceptApp() > > dw_Terminkalender_WV{oApp:MainWindow,,,{"KUNDE", > SELF:Server:Kunde}}:Show() > RETURN > > > But if i understand the gc it kicks all unused locals sometimes... if > the window "dw_terminkalender" still alive and the user lets say edid > a long time in that window will the gc kicks the local oApp ?? And end > again in a 5333er ? > > thanks for help, > > Mario -- Carlos Rocha
From: Geoff Schaller on 31 May 2010 19:09
Mario. There is no problem with this code and it is safe... but I would still prefer to NEVER use compound statements like that, even though they work. Here is what I suggest: METHOD TerminKunde() CLASS dw_Rechnungen LOCAL oApp AS conceptApp LOCAL oWin AS dw_Terminkalender LOCAL oSer AS WhatEverClass LOCAL oWin as MainWindowClass LOCAL cKunde as STRING oApp := GetconceptApp() oSer := SELF:Server cKunde := oServer:Kunde oWin := oApp:MainWindow oWin := dw_Terminkalender_WV{oWin,,,{"KUNDE", cKunde}} oWin:Show() RETURN NIL The reason? Well any error in the above code (server, owner or window caused) will only ever yield line 6 - and then do you look to the window class, the server class or what? The second reason for doing this is that if you now want to do some debugging, you can check values along the way before your original line 6 was executed. This code, even though it is more lines, can be stepped into properly. Thirdly, you can now insert code to handle potential errors such as the server is closed or Kunde is empty, etc. before the window is launched. Geoff "Mario Schulz" <info(a)removethiswegenspamconcept-dv.de> wrote in message news:htvt8g$49r$1(a)online.de: > Hi, > > as one part to solve my problems with 5333er i will get rid of any > globals in my app.. so i put the MainWindow ( Shellwindow) as a Protect > in my app object an declare an access to it.. in my source i use it as > follows : > > METHOD TerminKunde() CLASS dw_Rechnungen > LOCAL oApp AS conceptApp > > oApp := GetconceptApp() > > dw_Terminkalender_WV{oApp:MainWindow,,,{"KUNDE", > SELF:Server:Kunde}}:Show() > RETURN > > > But if i understand the gc it kicks all unused locals sometimes... if > the window "dw_terminkalender" still alive and the user lets say edid a > long time in that window will the gc kicks the local oApp ?? And end > again in a 5333er ? > > thanks for help, > > Mario |