Global cache
Form Init method after super
/// <summary>
/// When form opens it will set the container value
/// </summary>
/// <param name="_handle">
/// habdle buffer will come from TrvExpTable init method
/// </param>
/// <remarks>
/// When form opens it will set the container value
/// </remarks>
public static client void addHandleToCache(int _handle)
{
#define.CACHE_OWNER('TrvExpTable')
container con;
int hWnd,i;
if (infolog.globalCache().isSet(#CACHE_OWNER, curUserId()))
{
con = infolog.globalCache().get(#CACHE_OWNER, curUserId());
}
for (i = conLen(con); i >= 1; i--)
{
hWnd = conPeek(con, i);
if (!WinApi::isWindow(hWnd))
{
conDel(con, i, 1);
}
}
con += _handle;
infolog.globalCache().set(#CACHE_OWNER, curUserId(), con);
}
Application class - SetDefaultCompany Method
/// <summary>
/// When user tries to change company it will check either trvexptable form is open or not
/// </summary>
/// <returns>
/// true or false
/// </returns>
/// <remarks>
/// When user tries to change company it will check either trvexptable form is open or not
/// </remarks>
public static boolean hasOpenChildForms()
{
#define.CACHE_OWNER('TrvExpTable')
container con;
int hWnd,i;
boolean ret;
if (infolog.globalCache().isSet(#CACHE_OWNER, curUserId()))
{
con = infolog.globalCache().get(#CACHE_OWNER, curUserId());
}
for (i = conLen(con); i >= 1; i--)
{
hWnd = conPeek(con, i);
if (WinApi::isWindow(hWnd))
{
ret = true;
}
else
{
conDel(con, i, 1);
}
}
return ret;
}
Form close method before super
/// <summary>
/// When trvexptable form close it will reset the container value
/// </summary>
/// <param name="_handle">
/// habdle buffer will come from TrvExpTable close method
/// </param>
/// <remarks>
/// When trvexptable form close it will reset the container value
/// </remarks>
public static client void hasRemove(int _handle)
{
#define.CACHE_OWNER('TrvExpTable')
container con;
int hWnd,i,j;
if (infolog.globalCache().isSet(#CACHE_OWNER, curUserId()))
{
con = infolog.globalCache().get(#CACHE_OWNER, curUserId());
}
for (i = conLen(con); i >= 1; i--)
{
hWnd = conPeek(con, i);
if (!WinApi::isWindow(hWnd))
{
conDel(con, i, 1);
}
}
j = conFind(con, _handle);
con = conDel(con, j, 1);
infolog.globalCache().set(#CACHE_OWNER, curUserId(), con);
}
Comments
Post a Comment