Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

A5_window_list() vs A5_list_open_windows()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    A5_window_list() vs A5_list_open_windows()

    In the IW these are the results I get from each of these functions:

    Used in the system Form Menu:

    ?a5_window_list()
    = {DATA=!a5_controlpanel_activate()}{I=$a5_controlpanel}Control Panel
    {DATA=!Home.activate()}{I=$a5_form}Main Menu
    {Data=!obj("Contact_Type").activate()}{I=$a5_browse}Contact_Type
    {F=+B}{DATA=!Code_Editor.activate()}{I=$a5_script}Code Editor
    {I=$$generic.help}{DATA=!__a5documentation_window.activate()} Alpha Anywhere Documentation

    What I am using in an XD xml toolbox script:

    ?a5_list_open_windows()
    = ControlPanel
    Home
    Code_Editor
    __a5documentation_window

    The difference between these two functions is the first will list a browse but the second will not. Also in the 2nd I can get a pointer to the object name and use a doubleclick event to close it. The first will not do this. Both functions will activate the window when clicked. So of course, I want to do both in my XD, show the named browse in the list of open windows and also be able to activate it as well as close it from the list.

    The 1st function is returning the normalized name for the browse object that I assigned using this.window_title = "Contact_Type" in the OnInit event for the browse. It does not however show that title in the browse title bar but instead displays the table name. So much for naming a browse...

    Any ideas before I change all these named browses to embedded browses on forms?
    Last edited by MoGrace; 09-27-2016, 10:41 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    #2
    Re: A5_window_list() vs A5_list_open_windows()

    This is frustrating, its over a month and I have still not been able to resolve this. In fact is seems that none of the Action Scripts will display the name of an open browse object. Try activate and open form or browse in the IW and the genie list leaves a blank line where the browse name should appear.

    I would think that by now someone must have a way to do this! After all the window bar can display it...
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: A5_window_list() vs A5_list_open_windows()

      Get your own list of browses to add to the list open windows?

      FUNCTION opnd_browses AS C ( )
      opn_browses = ""
      all_browses = a5.Browse_Enum(2)
      for each foo in all_browses
      if is_object(foo.value)
      opn_browses = opn_browses+object_name_normalize(foo.value)+crlf()
      end if
      next
      opnd_browses = opn_browses
      END FUNCTION

      Then again you might want to submit a bug report. a5_list_open_windows() does list browses in v11.
      Last edited by Stan Mathews; 11-08-2016, 04:54 PM.
      There can be only one.

      Comment


        #4
        Re: A5_window_list() vs A5_list_open_windows()

        Hi Stan
        That was what I was thinking I needed to do but didn't know how to go about it - as usual you make the solution easy to understand.

        Thank you,
        Robin

        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

        Comment


          #5
          Re: A5_window_list() vs A5_list_open_windows()

          Well after a few interactions with Selwyn who was not able to duplicate my error with the A5_List_Open_Windows() function, he graciously gave me the source code:

          function a5_list_open_windows as c ()
          'DESCRIPTION:Returns a CRLF list of all open window names
          'LIMITATIONS:X
          xx = a5_window_list()
          xx = stritran(xx,"a5_controlpanel_activate()","ControlPanel.activate()")
          xx=*for_each(x,word(word_i(x,2,"{DATA=!"),1,"}"),xx)
          xx = stritran(xx,".activate()","")
          xx = stritran(xx,"obj(","")
          xx = stritran(xx,")","")
          xx = stritran(xx,""","")
          a5_list_open_windows = xx
          end function

          The line in blue was not happening with my copy of this function for a browse. So I made a new UDF with his code and now it works fine.

          I am using AA 12.4.2 3670_4684 just in case anyone else runs into this.
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #6
            Re: A5_window_list() vs A5_list_open_windows()

            Hi Robin,
            Not sure if this will help, but I wrote this a while back that I use to look into these matters.

            Code:
            FUNCTION open_table_form_report AS C (show_report as C="yes")
            
            '************************************************************************************
            'This produces an Xdialog showing all the currently open tables and forms 
            'vOpenT = "ALL OPEN TABLES"
            'vOpenFW = "ALL OPEN FORMS"
            'vOpenWin = "ALL OPEN WINDOWS"
            'vOpenO = "NON-CURRENT WINDOWS
            'vOpenH = "HIDDEN WINDOWS
            
            '************************************************************************************
            
            ' generates crlf() lis of open tables and enumerates them
            	dim vOpenT as C
            	dim vOTenum as N
            	vOpenT = table.enum_open()
            	vOTenum = w_count(vOpenT,crlf())+2
            
            ' form enumeration
            	dim shared vOpenF as C
            	lst = a5.form_enum(2)
            		vOpenF = ""
            		cnt = w_count(lst,crlf())
            		FOR i = 1 TO cnt
            			IF is_object(word(lst,i,crlf()))
            				vOpenF = vOpenF + crlf()+word(lst,i,crlf())
            				for m = 1 to 100
            					IF is_object(word(lst,i,crlf())+alltrim(str(m-1)))
            						vOpenF = vOpenF + crlf()+word(lst,i,crlf())+alltrim(str(m-1))
            					end if
            				next m
            			END IF
            		NEXT i
            		vOpenF = stritran(vOpenF,crlf(),"",1,1)
            		'ui_msg_box("Forms open:", vOpenF)
            
            ' dim variables to enumerate tables and forms
            	dim shared otfr_list as C
            	dim vOpenFW as C=""
            	dim vOpenW as C=""
            	dim vOpenO as C=""
            	dim vOpenH as C=""
            	dim vLenumFW as N
            	dim vcurrentW as C
            	dim vwinT as C
            	dim vFRep as C
            
            ' a_form_current
            	vcurrentW = a_form_current
            	'ui_msg_box("vCurrentW:", vCurrentW)
            
            ' All Open Windows
            	vOpenWin = a5_list_open_windows()
            	'ui_msg_box("vOpenW:", vOpenWin)
            
            ' Combined and culled
            	vOpenFW = word_unique(vOpenF+crlf()+vOpenWin,crlf())
            	vLenum = w_count(vOpenFW,crlf())+3
            	'msgbox("All Open Forms"+str(vLenum), vOpenFW)
            	
            'Windows other than CURRENT
            	dim vOpenO as C
            	vOpenO = word_subtract(vOpenFW,vCurrentW,crlf())
            	'ui_msg_box("Other Open Windows:", vOpenO)
            	
            ' Hidden Windows
            	dim vOpenH as C
            	vOpenH = word_subtract(vOpenFW,vOpenWin,crlf())
            	'ui_msg_box("HIDDEN:", vOpenH)
            
            'CHOOSE THE OUTPUT
            	OTFR_LIST=vOpenFW 
            
            'Create an XDialog 
            vOpenT = "ALL OPEN TABLES: "+crlf()+"-----------------------------------"+crlf()+vOpenT
            vOpenFW = "ALL OPEN FORMS: "+crlf()+"-----------------------------------"+crlf()+vOpenFW
            vOpenWin = "ALL OPEN WINDOWS: "+CRLF()+"----------------------------------"+crlf()+vOpenWin
            vOpenO = "NON-CURRENT WINDOWS: "+crlf()+"----------------------------------"+crlf()+vOpenO
            vOpenH = "HIDDEN WINDOWS: "+CRLF()+"----------------------------------"+CRLF()+vOpenH
            
            z1 = <<%dg1%
            {Font=Arial,8,B}
            {background=black}
            {region1}
            [.28,%dg1%
            
            z2 = <<%dg1b%
            vOpenT^#vOpenT]|{sp}|[.34,%dg1b%
            
            z3 = <<%dg2%
            vOpenFW^#vOpenFW]|{sp}|[.34,%dg2%
            
            z4 = <<%dg3%
            vOpenW^#vOpenWin]|{sp}|[.34,%dg3%
            
            z5 = <<%dg4%
            vOpenO^#vOpenO]|{sp}|[.34,%dg4%
            
            z6 = <<%dg5%
            vOpenH^#vOpenH]
            {line=1,0};
            {endregion1};
            {lf};
            {line=1,1}
            {lf};
            {initial_focus}<*15OK!OK> 
            ;%dg5%
            
            vFRep = z1 + (""+vOTenum) + z2 + (""+vLenum) + z3 + (""+vLenum) + z4+ (""+vLenum) + z5 + (""+vLenum) + z6
            
            if show_report="yes"
            	ui_dlg_box("FORM REPORT",vFRep)
            end if
            
            END FUNCTION
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: A5_window_list() vs A5_list_open_windows()

              Hi Mike,
              That is nice. What I am doing involves a docked custom toolbar that will show layouts as they are opened, allow you to click on the list to activate it and use double click to close. I'd be happy to share the function if anyone is interested. I also have it filtered to omit my Home form from the list so it can't accidently be closed - except when I am logged in. It is working really well now.

              WinListTbar.jpg
              Last edited by MoGrace; 11-18-2016, 09:17 PM.
              Robin

              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

              Comment


                #8
                Re: A5_window_list() vs A5_list_open_windows()

                Hi Robin,
                It sounds very similar to the navigation system I have set up (UDF - Navigator()). I don't know if yours is a multi-user app, but the current app I am continuing with development is a multi-user networked app. I use a table that has the list of all the forms and what forms have data entry through the form fields and have a requirement for exclusivity. I use dialogs for 95% of data entry writing directly to the tables, but there are a few forms that arise as best solution for data entry through the form fields. I track in a tracking table what form(s) each user has open. The navigator() checks the form open tracking table for whether the form being called has data entry functionality with requirements for exclusive table access and in the event it does and is already opened by another user, it delivers a busy message and allows user into form with view-only capabilities. This reduces conflicts, and when there is a conflict, I know who has the form open with write capabilities, and how long they have been in the form to judge whether they are "squating" in a form that someone else has a need to use. I am currently working on expanding that system to have these data entry forms have a lack of activity time-out process, like bank, securities, and credit card web sites have. If anyone has a strategy for that with desktop I am all ears.
                Last edited by Mike Wilson; 11-20-2016, 11:57 AM.
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: A5_window_list() vs A5_list_open_windows()

                  I thought I would try adding my XD to a v11 app and discovered that word_i() is not an available function in v11. Does anyone know how to modify this line in post #5 or use a different function that would give the same results?

                  xx=*for_each(x,word(word_i(x,2,"{DATA=!"),1,"}"),xx)

                  Edit: I am a bit slow today...the original function worked in v11 so I don't need to use the function I wrote to override it for v12.

                  I hope,
                  Last edited by MoGrace; 02-22-2017, 04:56 PM.
                  Robin

                  Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                  Comment


                    #10
                    Re: A5_window_list() vs A5_list_open_windows()

                    Hi Robin,

                    I have tested the Word_i() from V11 - did not work at here.
                    and did not know the Word() has the " case-insensitive " issue.

                    Code:
                    test ="{Data=company name is Studio 1}Studio 1"
                    'x = word(test,2,"{Data=")             'OK
                    'x = word(test,2,"{DATA=")            'no
                    x = word_i(test,2,"{DATA=")           'Function: Word_i was not recognized
                    'x = word(word(test,2,"{DATA="),1,"}")	
                    msgbox(x)

                    Comment


                      #11
                      Re: A5_window_list() vs A5_list_open_windows()

                      Mike,
                      In our system(s), we always have users who open forms, and leave them open all day. We developed a number of scripts to attempt to knock them out if they are just "sitting" idle on a form. We use scheduled scripts to test for idle. the script is scheduled to run ever 2 minutes. At form activate, we run a script to initiate a couple of variables as counters to tell how long we've been "sitting. After an hour of idle, we display a message box telling them they've been idle too long, we commit the form, and close out the program. There is also a routine that runs at 9 pm to shut them out so we can run our nightly maintenance.

                      scpCheck_Closeit is the script that gets run every 2 minutes. It was initially created to make sure we had a method of kicking users out if there was a major issue where we need to do some emergency maintenance. We have a table with a "closeit" flag, and if it is set, we shut them down. the "idle_check()" function is run in this script. It continually reschedules itself to run every 2 minutes.
                      Code:
                      DIM aa as P
                      aa = addin.variables()
                      
                      'debugcheck2("scpCheck_closit")
                      varinit()                     ---->   This is an internal function to set a number of agency-specific variables
                      dim global cTime_Chck as C
                      dim global nTime_Slot as N
                      nTime_Slot = 1
                      'aa.bcbss.cformcnt = toseconds(time())
                      idle_check()
                      closeit()
                      
                      cTime_Chck = totime(toseconds(time("0h:0m",now()))+120,1,0)
                      
                      script_schedule("scpCheck_Closeit",cTime_Chck,nTime_Slot)
                      Init_idle() is a function that sets the "timer"
                      Code:
                      FUNCTION Init_idle AS V ( )
                      '	Function Init_idle() initializes the idle counter for a screen.  
                      '	variables:		cform = current form name
                      '					cformcnt = time form was activated (menu) or a record was fetched (data screen)
                      '					timercnt = initialize a separate timer counter for forms that have less than 120 
                      '								on-timer event interval
                      '	This function works in conjunction with idle_check() to insure that social services will close down
                      '		after 60 minutes of being idle on any one screen.
                      '	if level = "A"
                      '		end 
                      '	end if
                      	DIM aa as P
                      	aa = addin.variables()
                      	aa.bcbss.cform = parentform.Name()
                      	aa.bcbss.cformcnt = toseconds(time())
                      	statusbar.SET_text("Form: " + ut(aa.bcbss.cform)+" Time: "+totime(aa.bcbss.cformcnt,2,0))
                      	'initialize timer counter to make sure we only do the idle check every 2 minutes.
                      	aa.bcbss.timercnt = 0
                      END FUNCTION
                      Idle_check() is function that is called from a scheduled script scheduled to run every 2 minutes It does a number of things. Our own internal security system is updated (secure2) table.
                      Code:
                      FUNCTION idle_check AS V ( )
                      '	Function Idle_check() tests how long a particular form has been idle.  
                      '	variables:		cform = current form name
                      '					cformcnt = time form was activated (menu) or a record was last fetched (data screen)
                      '					timercnt = a separate timer counter for forms that have less than 120 second
                      '								on-timer event interval
                      '	This function works in conjunction with init_idle() to insure that social services will close down
                      '		after 90 minutes of being idle on any one screen.
                      '	if level = "A"
                      '		end 
                      '	end if
                      'debugcheck2("Idle_check")
                      	DIM aa as P
                      	aa = addin.variables()
                      '	if level = "A"
                      '		end 
                      '	end if
                      	idletime = str(floor((toseconds(time())-aa.bcbss.cformcnt)/60),2,0)
                      	statusbar.SET_text("Form: " + ut(aa.bcbss.cform)+" Open: "+totime(aa.bcbss.cformcnt,11,0)+" Now: "+time("0h:0m am")+" - Idle for "+idletime+" Minutes") 
                      	'aa.bcbss.cformcnt = aa.bcbss.cformcnt+1
                      	'debugcheck()
                      
                      	'bAfterHours added on 7/21/15 to avoid closing during work hours.
                      	dim bAfterHours as L = .F.
                      	bAfterHours = (time() > "21:00:00")		'bAfterHours is True if current time is after 9:00PM. 
                      	if toseconds(time())> aa.bcbss.cformcnt+3600 		'too long, lets get out
                      		dim vmode as C = EVAL(AA.BCBSS.CFORM+".MODE_GET()")
                      		if vmode = "CHANGE" .or. vmode = "ENTRY"
                      			EVAL(AA.BCBSS.CFORM+".commit()")
                      		end if
                      		if level = "A"
                      			statusbar.SET_text("Form: " + ut(aa.bcbss.cform)+" Open: "+totime(aa.bcbss.cformcnt,11,0)+" Now: "+time("0h:0m am")+" - Idle over "+idletime+" Minutes") 
                      		  	aa.bcbss.cformcnt = toseconds(time())
                      		  else
                      		  	dim shared bOK as L = .F.
                      		  	script_play("Wait_Dialog_Tom")
                      		  	if  .not. bOK 	
                      		  		PleaseWait(.T.,"System Idle Too Long, Shutting Down")
                      				sleep(10)
                      				PleaseWait()
                      				dim sec as P
                      				sec = table.open(aa.bcbss.path+"\bcbss\secure2.dbf",FILE_RW_SHARED)
                      				sec.index_primary_put("empid")
                      				sec.fetch_find(aa.bcbss.emp_id)
                      				sec.change_begin()
                      					sec.active = ""
                      					sec.Activetime = ""
                      				sec.change_end(.T.)
                      				sec.close()
                      				xbasic_wait_for_idle(2)
                      				sleep(5)
                      				:a5.Close()
                      			  else
                      			  	aa.bcbss.cformcnt = toseconds(time())
                      			end if
                      		end if		 	
                      	end if
                      	debug(0)
                      END FUNCTION
                      WaitDialog_tom is just an annoying wait dialog that tells the user they are about to be kicked out.
                      Code:
                      a5.Maximize()
                      dim shared bOK as L = .F.
                      dim wd as WaitDialog
                      'play_sound("G:\bcbss\DONTDO.wav")
                      play_sound("Chimes")
                      wd.create(10,"Repeating")
                      wd.refresh()
                      wd.AllowCancel(.T.)
                      wd.Set_Dialog_Color("Pale Yellow")
                      wd.Set_Color("Red")
                      wd.Set_Message(crlf()+"     Social Services has been idle too long"+crlf())
                      wd.Set_Bottom_Message(crlf()+"               The program will Close!"+crlf()+"     Click \"CANCEL\" to stop the shutdown"+crlf())
                      wd.Set_Title("BCBSS Security")
                      for i = 1 to 1000000
                      	wd.refresh()
                      	if mod(i,100000)=0
                      		PLAY_SOUND("Chimes")
                      	END IF
                      	if wd.userCanceled
                      		bOK=.T.
                      		exit for
                      	end if
                      next i
                      
                      wd.Close()
                      You might have to tweak it a bit, but this seems to work for us as I get calls telling me the user's been kicked out.

                      Tom

                      Comment

                      Working...
                      X