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

Open form executes for OnPush event for button, but errors on DblClick for Tree

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

    Open form executes for OnPush event for button, but errors on DblClick for Tree

    Below is some extremely simple code to open a form. Can someone explain why A5V8 is having problems with it, when invoked from the DblClick method of an ActiveX control ctTree from DBI-Tech?

    I am trying to get Alpha Five to "play nice" with standard ActiveX controls used by the Visual Basic world. I'll have to admit this is more of a challenge than I originally thought it would be.

    Excluding the function and end function statements, when this code is inserted in a A5 Button's OnPush event, it correctly opens form frmTest.

    Code:
    function dblclick as v ()
       debug(1)
       dim frm as P  
       frm = Form.Load("frmTest") 
       frm.Show()  
       frm.Activate() 
       debug(0)	
    end function
    When the code with the function and end function statements are inserted in the DblClick method of an ActiveX Tree Control the following error messages are received:

    frm = Form.Load("frmTest")
    An error occurred while running a script.
    Object does not support requested interface.

    frm.Show()
    Object does not support requested interface.
    Argument is incorrect data type.

    frm.Show()
    Property is write only.
    frmShow method not found

    I even tried converting an Action Script to open the form to XBasic and then pasted the resulting code into the the Tree Control's double click function. That didn't work either.

    The following error messages were received by that more complex code:

    An error occurred while running a script
    Form not found �frmTest�

    An error occurred while running a script.
    Argument is incorrect data type.

    An error occurred when running a script
    Property is write only
    varP_frmTest.New_Record method not found.

    There is no problem with the ActiveX control itself. When the statement

    msgbox("The control was double clicked")

    is placed within the function and end function lines and executed, the message box is displayed when any node on the tree is double clicked.

    '---------------------------------------------------------------
    Below is the vendor's documentation

    DblClick Event

    Description
    Occurs when the user presses and releases a mouse button and then presses and releases it again over an object.

    Syntax
    Public Event DblClick()

    See Also
    ctTree Object

    '---------------------------------------------------------------
    It would seem to me that the ActiveX control has done its work, that is responded when a node on the tree was double clicked. Any ideas on why Alpha Five can not execute such simple code without errors?

    Thanks,
    Bob
    Pittsburgh

    #2
    Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

    Bob,

    I do not have any experience mixing xbasic and ActiveX but will offer this in case it triggers something for you.

    Firstly as far as the xbasic goes and using form.load make sure you also add frm.close() to close the form that is still in memory. Form.load() loads the form into memory. At this point you can manipulate the form and its objects using the frm pointer. frm.show() displays the form and activates it. (so you don't need frm.activate()) At this point the xbasic is halted until the form is closed by the user. (Which is another reason frm.activate() is not only redundent but I have seen it cause problems by having it there because it is trying to activate a form that is still resident in memory but not visible.) After the form is closed by the user you still have access to it via the form pointer 'frm', useful for grabbing form values to use further in the script. The user's action of closing the form doesn't really close it but sort of unshows it. when you are truly finished with it then use frm.close().

    Now for my attempt at your ActiveX problem. At first I figured trying to run xbasic code from within an activex would not work because it was in the wrong context or scope but then you said that the msgbox() function does work. So unless the ctTree activex also has a msgbox() function lets assume for the moment that you can indeed call xbasic functions from the ctTree activeX. In that case save your form calling function as a global function in the code tab of alpha5 and call it say 'Load_Form'
    Code:
    function Load_Form as v (FormName as c)
       debug(1)
       dim frm as P  
       frm = Form.Load(FormName) 
       frm.Show()  
       frm.close() 
       debug(0)    
    end function
    You may want to test that the function works by invoking it from the Interactive window first with Load_Form("frmTest")

    Then replace 'msgbox("The control was double clicked")' in your ActiveX code with Load_Form("frmTest")

    This is purely guess work as I do not have ctTree or similar to work with. Hopefully Marcel or Ira or Dr. Wayne will chime in and give you proper advice.

    Cheers and good luck
    Last edited by Tim Kiebert; 12-26-2007, 12:07 AM.
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

    Comment


      #3
      Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

      Tim,

      Thank you for your code suggestion, but it appears that Alpha Five is still having problems. But there may be another issue if you can read the entire message.

      The same error messages are received regardless of whether the code to open a form is directly executed from the DblClick event or the code is indirectly executed from a function executed from the DblClick event.

      Here's what I did and the results.

      1. Create a function

      FUNCTION LOAD_FORM AS V (FormName as C)
      dim frm as P
      frm = Form.Load(FormName)
      frm.Show()
      frm.Activate()
      END FUNCTION

      2. Call that function with XBasic as follows:

      Load_Form("frmTest")

      This worked just fine when I put the code behind a Alpha Five button for the OnPush event. So far, so good.

      Then as you suggested, I inserted the code into the DblClick event for the ctTree control (3rd party ActiveX control from dbi-tech.com). Doing so gave me basically the same errors as before:

      Load_Form("frmTest"):
      An error occured while running a script
      Object does not support requested interface

      I hit enter key and the debugger then launched into the function code

      Dim frm as P
      No error message received

      frm = Form.Load(FormName)
      An error occured while running a script
      Object does not support requested interface

      frm.Show()
      An error occured while running a script
      Argument is incorrect data type
      An error occured while running a script
      Property is write only
      frmShow method not found

      frmActive()
      An error occurred while running a script
      Argument is incorrect data type

      '---------------------------------------------------------------------
      I tried something new:

      I placed ctButton (3rd party ActiveX button control from dbi-tech) on my Alpha Five form and placed the following "simple" XBasic code behind it:

      function click as V()
      dim frm as P
      frm = Form.Load("frmTest")
      frm.Show()
      frm.Activate()
      end function

      It works! The form frmTest was successfully opened.

      '-------------------------------------------------------------------------
      So now I am faced with an even broader question: Why does the "simple" code succeed when used with ctButton and fail when used with ctTree, as noted in my original post?

      Both ctButton and ctTree are from the same 3rd party firm dbi-tech.com.
      The only difference is the event: for ctButton I used event Click and for ctTree I used event DblClick.

      Any ideas of what to do next? Needless to say, I am perplexed!

      Thanks,
      Bob
      Pittsburgh

      Comment


        #4
        Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

        Perhaps someone associated with dbi-tech can shed some light on why code specified in one of their events/controls executes properly... but the same code in another one of their events/controls does not.

        After thought:

        Does the tree control have a click event? As you say, that seems to be "the only difference," if we are to assume (big assumtion) that dbi-tech's code execution logic is consistent across controls.
        "all things should be as simple as possible... but no simpler"

        Mike

        Comment


          #5
          DBI responds: Alpha Five IDE issue?

          Guys,

          You've come through before, and I would sure appreciate your help in how to accomplish "set the timer to active and have it launch the form" as suggested in the response from the ctTree ActiveX control software firm below.

          I have also attached a screen shot of my result so far, which is similar to Steve Woods (AlphaToGo) posting "Pseudo-collapsible navigation menu" posted just two days ago. Note that my approach should present to the user a true collapsible navigation menu. Right now I am building the Tree from Code, but plan to eventually build its nodes and form references from a database file.

          Finally, I have attached a fairly descriptive description of the issue laden with screen shots that I submitted to DBI-Tech support, for those of you who may be interested in further details. When I get all the pieces assembled, I plan to post the details to keep someone else from reinventing the wheel.

          Tech support answer:

          Often IDE's can have issues instantiating forms from the ActiveX container, this is most noteable in FoxPro.

          It would appear the issue would be indicative (as Alpha5 is not of our listed products I can't test this myself) but it would appear that may indeed be further code executing that may throw the error after the doubleclick.

          As the Tree control is a bit more complex than the ctButton, this may be the issue (for example, we may have code to check for node status after the double click).

          As such, we recommend opening forms from Timers on the main form in any IDE (except VB6, it just works, gotta love all the different implementations of ActiveX containers).

          Essentially (and I'm not even sure if Alpha 5 has a timer) we put a disabled timer on the form with the code to launch your second form.

          During our dblclick event set the timer to active and have it launch the form. Once again, speaking generically (VFP9 is the basis) once the
          form is launched from a timer, it is essentially attached to the main form doing the calling as opposed to the ActiveX container. So give that a shot and see if it will clear that up.

          On a side note, it is always interesting to hear about the different dev
          environments trying our controls, can you forward me a link to the Alpha5 dev environment page so I can take a peek?

          Comment


            #6
            Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

            Bob,
            I don't know anything about the ActiveX control you're using, but I haven't had any trouble getting the Microsoft Tree Control to call a form, using the same dblclick() code:

            Code:
            tree.events=<<%code%
            function dblclick as v()
            	if tree.object.selectedItem.text="Launch" then
            	    frm=form.load("alpha mail")
            	    frm.show()
            	    frm.activate()
            	end if
            end function
            %code%
            So it makes me wonder whether the fault is with your ActiveX control. Particulary if they also have issues with Foxpro and other environments.

            Comment


              #7
              Alpha Five produces same errors this time with a total different 3rd party ActiveX

              Alpha Five produces the same errors with a different ActiveX control from a different company.

              I'm running out of ideas: this is twice that Alpha Five has choked with the same errors, which leads me to now think that there is something wrong with A5, not the controls.

              It fails with ctTree from DBI Tech and now with FMSTimer from FMS Inc., both respected ActiveX control firms. Any suggestions for next steps? What attracted me intially to A5 was its promise of application with minimal coding and the ability to incorporate ActiveX controls.

              For those who may be new to this thread, let�s summarize our findings thus far:

              1. We are attempting to open an Alpha Five form from a collapsible menu
              using a third party ActiveX control ctTree from DBI Tech (dbi-tech.com)

              2. Alpha Five errors when XBasic code is used to open a form by double
              clicking on ctTree.

              3. Alpha Five does NOT error when XBasic code is used to open a form by
              clicking using a different third party ActiveX control ctButton, also from
              DBI tech.

              4. Tim Kiebert in this thread suggested calling a function instead of
              executing the code directly to open the form.

              a. Tim�s suggestion worked when the function was called from
              ctButton
              b. Tim�s suggestion did not work when the function was called from
              ctTree

              5. Michael Payton in this thread cautioned not to assume that these
              controls behaved the same way, even though they were from the same
              company.

              6. Peter Wayne in this thread reported that he had no problem opening an
              Alpha Five form from a Microsoft TreeView control.

              Now let�s continue our saga:

              1. I followed Peter Wayne�s suggestion and placed two controls side by
              side on my form: a Microsoft Tree View control and DBI tech ctTree
              control.

              I did not populate either of these controls with any nodes, but inserted
              my simple code to open an Alpha Five form.

              When the tree controls were displayed, both were blank.

              When I doubled clicked on the MS Tree View control, true to Peter
              Wayne�s comment, the Alpha Five form successfully opened.

              When I double clicked on the DBI-tech ctTree control, all the same
              errors as previously reported, were encountered.

              2. I filed a support request for DBI tech, and they suggested that FoxPro
              presented similar problems, and the best work around was to place a
              timer control on the form and to execute the open Alpha Five form
              from the timer control, not the ctTree control.

              3. This gets better. Alpha Five does not offer a timer control to place on a
              form. Interestingly, neither does DBI Tech as a part of its Component
              Toolbox 7.0 package of Active X controls.

              4. I placed an activeX timer control from another firm, FMS Inc., on
              my form. For those of you who may not be familiar with FMS
              (fmsinc.com), they specialize in controls for Microsoft Access, that are
              extremely easy to use.

              5. The timer control has one property and one event, defined as below.
              Property Interval The interval between OnTimer events
              Event OnTimer Called when the time specified by the interval
              has elapsed.

              Time timer control has only one property and one event. Using this control is
              as simple as setting the interval control to the desired millisecond value and
              writing code to handle the OnTimer event.

              Setting the interval property to zero stops the timer.

              6. When I couldn�t get the timer to work with the ctTree control, I decided to test it using an Alpha Five button control.

              7. Here�s exactly what I did (shown in screen print attachment)

              a. Placed a Alpha Five button on my form with the text �Trigger timer�

              b. Placed a FMS timer control on my form and in its ActiveX properties,
              set the interval to zero. This keeps the timer from executing its code immediately.

              c. Placed the following code behind the Alpha Five button�s OnPush event:

              Code:
                                       dim FMStimer as P
              		FMStimer = Activex2.ActiveX.this
              		msgbox("before set interval")
              		FMStimer.interval = 200
              		msgbox("after set interval")
              Note that Activex2 is the FMS timer control.

              d. Placed the following code behind the FMS timer
              control�s OnTimer event:

              Code:
                                       function ontimer as v ()
              	               debug(1)
              	               dim frm as P  
                                          frm = Form.Load("frmTest") 
                                          frm.Show()  
                                          frm.Activate() 	
              		end function
              e. Executed the form and clicked on the Alpha Five button. The results are
              screen printed in the attachment and summarized below:

              Messagebox: before set interval
              Messagebox: after set interval

              Debugger launched

              dim frm as P
              No errors encountered

              frm = Form.Load(�frmTest�)
              Error: Object does not support requested interface

              frm.Show()
              Error: Argument is incorrect data type
              Error: Property is write only. Frm.Show method not found

              frm.Activate()
              Error: Argument is incorrect data type
              Error: Property is write only. Frm.Activate method not
              found

              Note that these are the very same error messages I reported as the original problem in this message. What is unsettling is that these messages occurred with a totally different ActiveX control from a different company.

              Here were DBI tech�s responses to three questions I posed:

              Why does ctTree not work, but ctButton does?

              Because the control is more complex, as mentioned in the previous request, there may be code firing after the double click event, while the code may never actually be used, ie) IF..Then statements or other internal event firings such as redraw or node open/closed calculations, may be interfering with the new form being instantiated. As mentioned, this is IDE dependent, not specific to the control (we can open forms just fine in VB6 and even Access, however VFP has issues hence the timer workaround).

              Why does ctTree not work, but MS TreeView does?

              Because they are completely different architectures.

              Why does the suggestion from DBI Tech support blow up?

              Because you need to set the timer.Interval = 0 at the start of your timerevent code or it will recursively call itself.

              I have forwarded your note on to the marketing department, and rest assured, we aren't abandoning the ActiveX product line, in fact there are plans to implement some of the Vista styles into the controls for the next release of the Component
              Toolbox line.


              Why is this relevant to Alpha Five users? Because in these days of everything .net, DBI plans to continue to improve and support activeX controls, which can give A5 applications a more professional, polished appearance than possible with just A5 controls.
              Last edited by rmcgaffic; 01-24-2008, 05:00 PM.

              Comment


                #8
                Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

                Robert,

                Just curious...why won't a form's Timer event do as you want??
                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: Open form executes for OnPush event for button, but errors on DblClick for Tree

                  In the same vein as Mike, try something like this:

                  put this code in the OnTimer event of the form containing the ActiveX object:

                  Code:
                  dim global doIt as L
                  if doIt then
                      f=form.load("someForm")
                      f.show()
                      f.activate()
                      doIt=.f.
                  end if
                  and then set the entire form's Timer interval to 1 second.

                  In the dblclick event of the activeX component, insert
                  Code:
                  dim global doIt as L
                  doIt=.t.
                  That should work.

                  Comment


                    #10
                    Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

                    Peter,

                    Thanks for your suggestion. I'm pleased to confirm that it works fine; the only change I made was to change the internal from 1 sec to .01 second, which makes the form opening nearly instantaneous.

                    I am still concerned that Alpha Five did not work with FMSTimer, whose controls are geared to the Access 2003 and Access 2007 crowd.

                    Alpha Five's claims to use ActiveX controls may be overstated if my experience is any indication:

                    ctButton from DBI Tech -- Works with Alpha Five

                    ctTree from DBI Tech -- Does not work with Alpha Five
                    FMSTimer from FMS Inc. -- Does not work with Alpha Five
                    ctSplitter from DBI Tech -- Does not work with Alpha Five
                    FMSSplitter from FMS Inc. -- Does not work with Alpha Five

                    Do we need a listing of third party ActiveX controls that work with
                    Alpha Five? I would be interested from hearing from other users as to what
                    works natively, what works with a workaround (your suggestion above), what simply does not work with Alpha Five.

                    Bob
                    Pittsburgh

                    Comment


                      #11
                      Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

                      One question is whether the ActiveX controls you are using are geared specifically to Access forms. You mention that they may not work with Visual Foxpro, which is a Microsoft product, as you know. Also, the (admittedly limited) Microsoft tree control works fine with Alpha Five, although the dbi cTree control doesn't. Is this Alpha's fault, or dbi's?
                      My guess is that the controls you are having trouble with are making direct calls to Access forms. That's just a guess.
                      - Peter

                      Comment


                        #12
                        Re: Open form executes for OnPush event for button, but errors on DblClick for Tree

                        Peter,

                        Thanks for your insight. I wasn't trying to blame or fault anyone, just
                        trying to understand how users might better understand which 3rd party ActiveX controls have been proven to work with Alpha Five.

                        I am looking for a splitter control for placement directly on an Alpha Five form, rather than to create a form from code using XDialog.

                        But I also would like to see a more attractive Tab control (such as the ones Alpha Five uses itself).

                        Does anyone know of any?

                        Wouldn't it be great if Alpha Five maintained a inventory of ActiveX controls that have been certified to work with it. My assumption was that an ActiveX control is an ActiveX control, and that if it works with Visual Basic or Access, it would with Alpha Five.

                        Thanks,
                        Bob
                        Pittsburgh

                        Comment

                        Working...
                        X