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

Can't get sys_id_show() to work

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

    Can't get sys_id_show() to work

    I need to switch between 2 or more A5V9 applications from a button within each application.

    Example: I'm working in an open A5V9 application whose 'window name' is "2008-2009" and I push a button that has the folowing code:


    vEnum = containsi(sys_id_enum(),"2009-2010")
    ui_msg_box("",""+vEnum)
    if vEnum = .T. then
    sys_id_show("2009-2010")
    Else
    sys_open("C:\HWDATA\2009-2010\hwdata.adb")
    End if


    It's my understanding that if the application whose 'window' name is "2009-2010" is in the enumerated list that using sys_id_show("2009-2010") would make the "2009-2010" application the active window, otherwise sys_open("C:\HWDATA\2009-2010\hwdata.adb") would open the application (this part does work).

    Attached are 2 screen shots, the first shows a message box that indicates that the "2009-2010" window IS in the enumerated list, but the second screen shot shows an error that the window wasn't found.

    Am I mistaken about how sys_id_show() works? Or is the code wrong?

    In either case, I would really appreciate someone pointing me in the right direction as far as accomplishing what I need to do.
    Thanks
    JAS

    #2
    Re: Can't get sys_id_show() to work

    Sys_id_show() does not work in v8 either. Does not even show an error. I will look for an alternative....might be tomorrow before I find one unless I get lucky! :)


    EDIT: How about SYS_FOCUS_PUT().

    Sys_id_Show() seems to work for programs in the tray only. So used like the show and hide of the control panel....and the sys_focus_put() would be analogous to .activate().
    Last edited by MikeC; 05-19-2009, 01:41 AM.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________



    Comment


      #3
      Re: Can't get sys_id_show() to work

      Hi James

      In conjunction with my Useful Functions here this piece of code works perfectly and I've been using it for years.

      Code:
      [FONT=Courier New]IF file.exists("C:\WINDOWS\system32\calc.exe") = .T. THEN
       SELECT
        CASE is_window_open("calculator") = .T.
         sys_id_restore("calculator")
         sys_focus_put("calculator")
        CASE is_window_open("calculator") = .F.
         sys_open("C:\WINDOWS\system32\calc.exe")
       END SELECT
      END IF[/FONT]
      You will need to modify the sys_open() and window name, but should work for you.

      Also, you may need to rethink how you call the database, I haven't tried to run the database .adb name directly, but I suspect that it should be a shortcut link instead.
      If It Works First Time, There's Something Wrong!!!

      Comment


        #4
        Re: Can't get sys_id_show() to work

        I'm not sure you can run multiple databases in a single Alpha Five session.

        Have you considered using A5.Load() to close the current database and then open a new one?

        Comment


          #5
          Re: Can't get sys_id_show() to work

          Chris:

          Thanks for your help.

          When I tried your code I got a
          "CASE is_window_open("calculator")" Function not recognized error.

          so I changed the code as follows:

          Code:
          vEnum  =containsi(sys_id_enum(),"calculator")
          
          IF file.exists("C:\WINDOWS\system32\calc.exe") = .T. THEN
           SELECT
            CASE vEnum = .T.
             sys_id_restore("calculator")
             sys_focus_put("calculator")
            CASE vEnum = .F.
             sys_open("C:\WINDOWS\system32\calc.exe")
           END SELECT
          END IF
          And it worked exactly the way I would like my applications to work.
          However, when I changed the code to use my info:

          Code:
          vEnum  = containsi(sys_id_enum(),"2009-2010")
          
          IF file.exists("C:\HWDATA\2009-2010\hwdata.adb") = .T. THEN
           SELECT
            CASE vEnum = .T.
             sys_id_restore("2009-2010")
             sys_focus_put("2009-2010")
            CASE vEnum = .F.
             sys_open("C:\HWDATA\2009-2010\hwdata.adb")
           END SELECT
          END IF
          I get exactly the same error as before. It appears it is not recognizing the window name of my application. Yet whwn I do ?sys_id_enum() in the interactive window that is the name that shows up, and when I run ?containsi(sys_id_enum(),"2009-2010") I get a TRUE answer back.

          I just don't get it!!

          Comment


            #6
            Re: Can't get sys_id_show() to work

            James,
            How do you get a folder's window title to be just called 2009-2010 ? Are you sure of that window title? Maybe it is C:\HWDATA\2009-2010?? or similar.

            BTW the containsi function only tells you that the string contains the word(s) you tell it to look for....not that it is a correct title or whathaveyou.
            Mike
            __________________________________________
            It is only when we forget all our learning that we begin to know.
            It's not what you look at that matters, it's what you see.
            Henry David Thoreau
            __________________________________________



            Comment


              #7
              Re: Can't get sys_id_show() to work

              Tom:

              I'm not sure you can run multiple databases in a single Alpha Five session.
              I'm not running a single Alpha Five session. The client is a school that does purchase orders for each school year. Sometimes PO's are made for the next school year during the current school year and the client wants a permanent history for each school year. So, I set up a single button click that creates a new school year period when needed by copying the current application folder(ex: c:\hwdata\2008-2009\) to a newly created folder (ex:c:\hwdata\2009-2010\) then closes the current application(2008-2009), opens the new application(2009-2010) and empties the PO header and lineitem tables. The client now has a fresh PO application for the new school year and still retains the current school year intact. I also set up a 3rd start-up mini application that is used to allow the client to choose which school year application to open after double clicking a shortcut on the desktop.

              Lets say the client opens the 2008-2009 application and enters several PO's and then receives a PO for the 2009-2010 school year. There is now a button on the Main Menu that will open a second AlphaFive session by opening the 2009-2010 application. Both applications are now open. What I want to achieve is to be able to switch from one to the other with a single button click from within either application. Actually that's what the client wants to achieve. I've suggested that she just use the taskbar to switch from one to the other but she would prefer a button from within the application.

              The code Chris suggests opens the Windows Calculator if it is not already open, and if it is open the code switches or gives focus to the Windows Calculator.

              That is basically what I want to achieve with the Alpha Five applications but sadly it is beginning to appear to be a no-go!

              Thanks for your input.
              JAS

              Comment


                #8
                Re: Can't get sys_id_show() to work

                James,
                If I am understanding you correctly, it sure seems to work for me using a small runtime application I have called "Interchange" and using the interactive window of the development version of Alpha. I used the following and if it is open it brings it up...if it is closed it starts it.....The main window is called "Amherst Marine".

                Code:
                vEnum  = containsi(sys_id_enum(),"Amherst Marine")
                
                 SELECT
                  CASE vEnum = .T.
                   sys_id_restore("Amherst Marine")
                   sys_focus_put("Amherst Marine")
                  CASE vEnum = .F.
                   sys_open("C:\Documents and Settings\Mike\My Documents\Interchange\_Interchange.adb")
                 END SELECT
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Can't get sys_id_show() to work

                  James, I appreciate the further explanation. Can't help you. In similar cases here I've simply created new tables for the next year, or sometimes I add a date or year field to table structures. Switching between years is a simple matter of either opening a different table (in the first case) or running a query against a single master table (in the second). -- tom

                  Comment


                    #10
                    Re: Can't get sys_id_show() to work

                    Hi James

                    The reason that it is not working, is that the window name used in the sys_id_restore() and sys_focus_put() is not "2009-2010". The window name only 'contains' this phrase. You will have to work out what the window name really is.
                    Last edited by ChrisHawkes; 05-20-2009, 08:37 AM.
                    If It Works First Time, There's Something Wrong!!!

                    Comment


                      #11
                      Re: Can't get sys_id_show() to work

                      Chris:

                      I'm confused, the description in the Alpha Five Help File for SYS_ID_ENUM() is as follows:

                      SYS_ID_ENUM() creates a CR-LF delimited character string that lists the windows currently available on your system.
                      I took that to mean that the character strings in the list were the actual window titles. When I run ?SYS_ID_ENUM() in the interactive window I get a crlf() delimited list, a portion of which is shown below:

                      Code:
                      ?sys_id_enum()
                      = LogMeIn
                      TF_FloatingLangBar_WndTitle
                      CiceroUIWndFrame
                      SysFader
                      [COLOR="Blue"]Calculator[/COLOR]
                      Alpha Five - [Code Editor]
                      [COLOR="Red"]2009-2010  [/COLOR]
                      DDE Server Window
                      DDE Server Window
                      LogMeInClipSpy
                      LogMeIn RC Notification Sink
                      Brownie (Installation report)
                      MCI command handling window
                      MCI command handling window
                      HiddenFaxWindow
                      NVSVCPMMWindowClass
                      Uniblue RegistryBooster 2
                      Connections Tray
                      Uniblue SpyEraser
                      Power Meter
                      UPnP Notification Monitor
                      MS_WebcheckMonitor
                      Brother HL-2170W series on BRW00234ECDD0CD
                      Program Manager

                      I wasn't using containsi() to determine the window name. It was just a convenient method to verify that it was there since I had already run sys_id_enum() to (I thought) determine the actual window name as shown above.

                      If 2009-2010 (highlighted in red) is not the actual window name for the open Alpha Five application but Calculator (highlighted in blue) is the actual window name for Calculator, then how would I go about determining the actual window name for 2009-2010??

                      JAS

                      Comment


                        #12
                        Re: Can't get sys_id_show() to work

                        All I can say is that I can get it to work here with no problems. I've tested it in v6, v7, & v8. I don't have v9, so I suppose it's possible there's a bug, but I seriously doubt it. Don't know what else to suggest.
                        If It Works First Time, There's Something Wrong!!!

                        Comment


                          #13
                          Re: Can't get sys_id_show() to work

                          unless there is some specific reason you cannot have separate tables for each year range, I would take Tom's advice
                          Cole Custom Programming - Terrell, Texas
                          972 524 8714
                          [email protected]

                          ____________________
                          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                          Comment

                          Working...
                          X