Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > GUI Development
  New Posts New Posts RSS Feed - Is there a way to query what forms are open?
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedIs there a way to query what forms are open?

 Post Reply Post Reply
Author
Message
MEDPSD View Drop Down
Newbie
Newbie


Joined: March 05 2008
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MEDPSD Quote  Post ReplyReply Direct Link To This Post Topic: Is there a way to query what forms are open?
    Posted: April 10 2018 at 11:39am
I would like to not allow two forms in my application to be opened simultaneously.  (They both allow updates and are stepping on one another.)  I could do this via the program but was hoping there was a GUI call that would tell me what forms are currently open.  
Back to Top
Shrek59 View Drop Down
Senior Member
Senior Member


Joined: December 04 2006
Location: New Zealand
Status: Offline
Points: 208
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shrek59 Quote  Post ReplyReply Direct Link To This Post Posted: April 10 2018 at 2:16pm
Here is a subroutine that I use to determine if an APPLICATION is in memory. In my programming, application and form usually relate to the same thing - but if you have multiple forms per application, then you may need to adapt this a bit:

SUBROUTINE Q.ATGUI.CHECK4APP(app, found, guierrors, guistate)
*****************************************************************************
* Author : BSS
* Created: 27 Mar 2017
* Updated: 27 Mar 2017
* Version: 1.0.0
* Desc   : Check to see if an application is in memory.
*
* ------------------------------------------------------------------------- *
*
$INCLUDE GUIBP ATGUIEQUATES
EQUATE ERR.FAIL TO 2

found = @FALSE
CALL ATGUIGETPROP(GXROOT, '', '', GPSTATUS, 2, 0, objects, guierrors, guistate)
IF (guierrors<1> GE ERR.FAIL) THEN RETURN

LOCATE app IN objects<1> SETTING objpos THEN found = @TRUE

RETURN
*
* ------------------------------------------------------------------------- *
*
END
That may give you some ideas.

Read the documentation on "Global Objects" to get some more information on what is happening in this subroutine.

Cheers,

Brian
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: April 16 2018 at 3:25pm
Hi Patrick -

The boilerplate CLOSE event handler has an example of this. The default handler for a form's Close event hides the form, then retrieves the number of forms that are visible from the GPSTATUS property of the app object. If no forms are visible, the app object is deleted. Generally there is only one app object for a project so the program ends.

As Brian mentioned, you can retrieve the GPSTATUS property of the global root object (GXROOT) to get a list or count of objects. The COL & ROW arguments select what type of information is returned. Call
ATGUIGETPROP(GXROOT, '', '', GPSTATUS, 0, 0, N, GUIERRORS, GUISTATE)
to return the number of visible forms. Or
ATGUIGETPROP(GXROOT, '', '', GPSTATUS, 2, 0, X, GUIERRORS, GUISTATE)
to return a list of app object IDs.

Thanks,

Pete

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.