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

ActiveX challenges: Non-zero based arrays and sub-properties causing errors for tree

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

    ActiveX challenges: Non-zero based arrays and sub-properties causing errors for tree

    Either this is a problem caused by Alpha's non-zero based arrays or A5V10 is having a problem with sub-properties. I'm not sure which. The objective is to allow a user to directly move items and nodes in a tree as he wishes, which is especially handy functionality for anyone interested in outlining or document management.

    Here's the error message:
    Code:
    Script:OnPush:12
    Grid1.Items.ItemPosition[myHandle] = myHandle -1
    Property not found
    Grid1.Items Subproperty can not be assigned to
    Probably the easiest way to understand this problem is to take a quick look at the attached Jing video, which shows an extremely simple example both using MS Access and A5V10. Access works; A5V10 using the same code does not. The only difference between the code is using ( ) for Access and [ ] for A5V10.

    Here�s the link: http://www.screencast.com/t/MjEzZTVjOW

    In it, the user is able to easily reposition a line in a grid, moving it up or down a hierarchical grid as desired. The example was built using an ActiveX control ExGrid from Exontrol.com.

    To keep this example simple, all records are at the same level in the hierarchy.

    When the MS Access form is loaded, the following variables are defined:

    Code:
    Dim myHandle As HITEM
    Dim myItemPosition As Integer
    Note that Microsoft Access recognizes that HITEM when the dimension statement is written as shown in the screen print below.

    The control�s documentation states:
    Code:
    HITEM	A long expression that indicates the 
    item's handle that indicates the newly created item.
    When the UP button is pushed, the following code executes:
    Code:
    �Move up
    myHandle = Grid1.Items.FocusItem
    myItemPosition = Grid1.Items.ItemPosition(myHandle)
    Grid1.Items.ItemPosition(myHandle) = myItemPosition � 1
    When the DOWN button is pushed, the following code executes:

    Code:
    'Move down
     myHandle = Grid1.Items.FocusItem
     myItemPosition = Grid1.Items.ItemPosition(myHandle)
     Grid1.Items.ItemPosition(myHandle) = myItemPosition + 1
    Here�s a brief explanation what the control is doing:

    The handle represents number generated by the ActiveX control which appears to be a large integer to uniquely identify each item in the grid. The item position represents the sequential number of the child item displayed in the grid.

    For example, displaying this information for the first line in message boxes
    might show the following values:

    myHandle = 136453920
    myItemPosition = 0

    When the exercise is repeated, the value of myHandle is randomly changed, for example:

    myHandle = 136451800
    myItemPosition = 0

    or when repeated one more time:

    myHandle = 136433168
    myItemPosition = 0

    The value of myHandle remains constant for a session, even though the MyItemPositon value can increase/decrease as the appropriate button to move the focus Up or Down

    Now let�s try to make this work with Alpha Five, remembering Selwyn�s guidance that in A5 arrays require square brackets [ ] and are based on 1 and not zero as is the case for Visual Basic.

    The following A5V10 code, a simple rewrite of VB to XBasic, is placed behind the OnInit event:

    Code:
    dim global Grid1 as P
    Grid1 = Activex1.ActiveX.this
    
    dim myHandle As N
    dim myItemPosition As N
    
    Grid1.LinesAtRoot = -1   
    Grid1.Columns.Add("Default")
    The following code is placed behind the DOWN button
    Code:
    myHandle = Grid1.Items.FocusItem
    myItemPosition = Grid1.Items.ItemPosition(myHandle)
    Grid1.Items.ItemPosition[myHandle] = myHandle +1
    The following code is placed behind the UP button
    Code:
    myHandle = Grid1.Items.FocusItem 
    myItemPosition = Grid1.Items.ItemPosition(myHandle) 
    Grid1.Items.ItemPosition[myHandle] = myHandle � 1
    When the up or down button�s are clicked, Alpha displays the following error message:

    Script:OnPush:12
    Grid1.Items.ItemPosition[myHandle] = myHandle -1
    Property not found
    Grid1.Items Subproperty can not be assigned to

    The only difference between the MS Access and A5 code is the use of square brackets.

    Also note that even though I attempted to dimension mHandle As HITEM just like in the Access example, A5 errored with the following message:

    Script:OnInit line:14
    dim mHandle As HITEM
    Type is not defined

    Therefore I redefined it as N.

    I don't see anything wrong with my use of subproperties, that is if something worked in MS Access, I expect that it should also work with A5V10.

    Is this an error of some sort on my part or a A5 bug?

    Bob McGaffic
    Pittsburgh, PA

    #2
    Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

    Hi Bob,

    If you have multiple levels of pointers, I believe Active X in Alpha has issues with them.

    Thus if you have Grid1.Items.variablename, the usage should use an intermediate pointer, such as

    dim grid1_items as P
    grid1_items=grid1.items
    dim grid1_columns as P
    grid1_columns=grid1.columns
    'etc.
    varval=grid1_items.variablename

    Assume if you have more than one . (period), there will be an issue when accessing Active X controls.

    Other than that, I haven't looked at your posting in great detail, as I can't view your jing right now.
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture


    Comment


      #3
      Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

      Ira,

      I have successfully used multiple periods with this control and A5V10 before.

      For example, here's some code from one of my earlier projects using both tools:

      Code:
      Grid1.Columns[1].Visible = .t.
      Grid1.Columns[1].Editor.EditType = 1 'Sets standard text edit field
      Grid1.Columns[1].Editor.Appearance = 8 'Single line border for cell editor
      A5V10 did not choke with either two or three periods.

      So I would think that this code would also work, but unfortunately it errors:

      Code:
      Grid1.Items.ItemPosition[myHandle] = myHandle - 1
      If you have 2 minutes, you may want to view my video to see how simple this is using MS Access, and I would hope would be equally easy using A5V10.

      Bob McGaffic
      Pittsburgh, PA

      Comment


        #4
        Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

        Bob,
        Two things....
        First, why would you figure that the exact same code that works in Access would work in Alpha? I would never have expected that, but if true it would be great of course!

        Second, just because something works in one place using the multiple "dots" does not necessarily mean it will always work ---and yes, consistency is expected, but if you look at it from a different perspective, it can make sense.....that is, it is quite possible that the multiple dots do work in specific situations but could just be the anomaly not the norm.

        Why not do as Ira suggests? Code that relies upon sometimes "odd" behavior of Alpha (read as either unexpected results or not normal), is not code that I would want to use.
        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


          #5
          Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

          Hi Bob,

          I just looked at your Jing. This is easily done in XDialog with existing documented features.

          It is also possible to drag and drop from a tree in XDialog, but is not a documented feature. I don't know if it's possible to drop into a tree, but have never tried. But if possible to drop into a tree, it's even possible to just drag the items around.
          Regards,

          Ira J. Perlow
          Computer Systems Design


          CSDA A5 Products
          New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
          CSDA Barcode Functions

          CSDA Code Utility
          CSDA Screen Capture


          Comment


            #6
            Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

            Mike,

            I misspoke. The code displayed above for Microsoft Access and A5V10 is not the exactly same code. It differs in the following respects:

            1. A5V10 requires a definition for the ActiveX control as P, which Access does not
            2. The arrays in A5v10 use [ ], not ( ), as does Access.

            I reasonably expect that after adjusting for minor peculiarities such as the above documented differences, the structure of VB/VBA code and XBasic should pretty much be the same, which to date has been my experience. It’s the undocumented differences that concern me.

            I have yet to find a controls vendor that offers any demos or samples written in XBasic. So when I find a sample written in your choice of VB6, VB7, C#, C++, VFP, Delphi, VBA, etc., I am hopeful that I can follow the pattern I see, and replicate the result using XBasic.

            Ira,

            Thanks for your suggestion, you can tell I’m grasping at straws on this one.

            I followed your suggestion but without success.

            As I mentioned earlier, the offending code is
            Code:
            Grid1.Items.ItemPosition[myHandle] = myItemPosition + 1
            I apologize for typing erroneous code in my previous post, which happens when you don't cut and paste. Even when I correct for my sloppiness, an error message is still received.

            Code:
            Grid1.Items.ItemPosition[myHandle] = myHandle + 1
            should be
            Grid1.Items.ItemPosition[myHandle] = myItemPosition + 1

            Even though A5V10 has well handled other statements with more than one period in them as shown by my previous post, I tried your suggestion with the following code:

            Code:
            'Move down
            
            myHandle = Grid1.Items.FocusItem
            msgbox(str(myHandle)) 'OK -- note two periods
            
            myItemPosition = Grid1.Items.ItemPosition(myHandle)
            msgbox(Str(myItemPosition)) 'OK -- note two periods
            'Also note that (myHandle) is OK, but [myHandle] errors 
            
            'This fails
            'Grid1.Items.ItemPosition[myHandle] = myItemPosition + 1
            
            'This fails
            'Grid1.Items.ItemPosition(myHandle) = myItemPosition + 1
            
            dim grid1_items as P
            grid1_items=grid1.items
            
            'This fails
            'grid1_items.ItemPosition[myHandle] = myItemPosition + 1
            
            'This also fails
            grid1_items.ItemPosition(myHandle) = myItemPosition + 1
            You will note that the above line of code has only one period in it.

            The following error message is received:

            Code:
            Script: OnPush line: 20
            grid1_items.ItemPosition[MyHandle] = myItemPosition + 1
            Property not found
            grid1_items.ItemPosition[] not found.
            Another thought has occurred to me, that A5V10 can’t handle the dimension statement correctly.

            If you take a look at the screen print below, you can see that Microsoft Access seems
            to recognize the dimension HITEM. A5V10 does not, hence my dimension of myHandle as N. But also note that A5V10 correctly displayed the value of MyHandle using a message box popup.

            I have attached a zipped database if anyone cares to play with this problem.
            The ExGrid control can be downloaded from Exontrol.com for an unlimited (you read right!) evaluation period.

            I’ll wait a day or two and if no forum member can point out an error on my part,
            I’ll submit a bug report.

            Bob McGaffic
            Pittsburgh, PA.

            Comment


              #7
              Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

              I submitted this as a bug report this morning.

              Bob McGaffic
              Pittsburgh, PA

              Comment


                #8
                Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

                sorry - posting error
                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


                  #9
                  Re: ActiveX challenges: Non-zero based arrays and sub-properties causing errors for

                  Selwyn got back to me within one day -- this guy is more responsive than calling 911!

                  He reported that my problem is due to a limitation of A5's ActiveX interface.

                  The problem can not be solved by defining pointers to two properties at a time.

                  To restate, here's the code that errored:
                  Code:
                  Grid1.Items.ItemPosition[myHandle] = myItemPosition + 1
                  Selwyn said this is the proper syntax:
                  Code:
                  Grid1.Items_A5SetProperty("ItemPosition", myItemPosition+1, myHandle)
                  He went on to explain that ItemPosition is an indexed property and as such, you can not set its value directly.

                  This method requires three arguments:
                  Name of the property
                  Value that you want to set the property to
                  Property index

                  I tried it and am pleased to report that it works beautifully.

                  However, I am concerned that this method appears to be undocumented.

                  I checked my A5V10 help and could find no reference.
                  Then I went online to Alphapedia with the following search terms
                  _A5SetProperty
                  A5SetProperty
                  SetProperty

                  No hits were found for any of the above search terms.

                  Bob McGaffic
                  Pittsburgh, PA

                  Comment

                  Working...
                  X