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

Dynamic Custom XML Toolbox

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

    Dynamic Custom XML Toolbox

    I am working on formatting an xml string from table data to generate an animated Toolbox to use as a global stand alone custom toolbar. I am using the xbasic from the Action Script for my model. I have found a couple of good posts on creating the xml but no one was trying to make one of these where grouping categories and their items like a tree is needed.

    In my script, I first created an array of the categories using a unique index from the table. I want to test this value as I loop thru the table getting the items and when another unique category value is encountered, create a new category xml tag. But I am getting an 'array out of bounds' error when I try to compare a variable with the array[i] value.

    My first question about this error: Is it 'ok' to open a table once, set a primary index, fetch thru the table to get the array and then change the primary index and fetch thru the same table again? Or is it better to close the table and reopen it?

    This is the part of the function that works fine:
    Code:
    GETCATS:
     tbl = table.open("act_menu")
     on error goto CLOSEIT
     idx = tbl.index_primary_put("Grp1_U") 'grp2_u
     crecs = idx.records_get()
     dim cats[crecs] as c  
     tbl.fetch_first()
     while .not. tbl.fetch_eof()
      i=i+1
      cats[i] = alltrim(tbl.menu_grp1) 'tbl.menu_grp2
      tbl.fetch_next()
     end while
     'TESTARRAY: 
     'to test the category array - comment out lines following GETITEMS
     'tbl.close() 
     'lst=ui_get_list_array("",1,"cats")
     'get_menu = lst
    But this next section throws the error:
    Code:
    GETITEMS: 
     i = 1
     idx = tbl.index_primary_put("SORTKEY")
     irecs = idx.records_get()
     tbl.fetch_first()
     'set the first category 
     catnm = alltrim(tbl.menu_grp1) 'tbl.menu_grp2
     lst = "<<%xml%"+crlf()+"<toolbox animate=\"true\" type=\"List\" theme=\"NATIVEWINXP\" >"+crlf()
     lst = lst+"<category name="+quote(cats[i])+"state="+quote(catstate)+" >"+crlf()
     'only first category is open all others will be closed
     catstate = "Closed"
     while .not. tbl.fetch_eof()
      [COLOR=#ff0000]if catnm <> cats[i] then
    [/COLOR]   lst = lst+"< /category>"+crlf()
       'only add a new category line if unique
       lst = "<category name="+quote(cats[i])+"state="+quote(catstate)+" >"+crlf()
       catnm = cats[i]   
      end if
      imgno = val(tbl.xmlimg)
      lst = lst+"<item text="+quote()tbl.menu_grp2)+" icon="+quote(imgs[imgno])+" data="+quote(tbl.obj_name)+" onclick="+quote(tbl.sortkey)+" />"+crlf()
      i = i+1
     tbl.fetch_next()
     end while
    all the variables are dimmed and set to default values
    Last edited by MoGrace; 01-08-2012, 10:14 PM.
    Robin

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

    #2
    Re: Dynamic Custom XML Toolbox

    Hi Robin,
    Seems to me that you would have to do the comparison either within the first section of code right after
    cats[i] = alltrim(tbl.menu_grp1)
    or rerun the setting of the array within the second code section, having the array again as part of the loop.
    Last edited by MikeC; 01-10-2012, 01:26 PM.
    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: Dynamic Custom XML Toolbox

      Hi Mike,
      I tested it in the IW and it worked fine. Perhaps if I dim the array variable as shared? I was looking at scripts by Steve Workings and Mark Pearson (Clunes) to adapt what I need. Steve used a FOR EACH statement, but I can't figure how to make that work for each category and then fetch the items related to that category to put them in the proper order before the next category is created.
      Robin

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

      Comment


        #4
        Re: Dynamic Custom XML Toolbox

        Mike,
        I got it! Instead of an array for the categories, I created a menu_cat table which can now be updated with any changes made in my act_menu form. Then I open both the menu_cat and act_menu tables and do a nested fetch.

        Here is my get_menu() function and the xml produced in the IW:

        Edit: Oops - just noticed that for 2 Categories that have only one Item, the Itemtext line got skipped...will have to fix that.

        Update: Added the finished function and script.
        Attached Files
        Last edited by MoGrace; 01-17-2012, 11:52 AM. Reason: Updated files
        Robin

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

        Comment


          #5
          Re: Dynamic Custom XML Toolbox

          Here was the problem:
          I also needed to add spaces for the Item to line up.

          Code:
          GETITEMS:
          while .not. btbl.fetch_eof()
              if alltrim(btbl.menu_grp1) = catnm then
                 j = j+1
                 imgno = val(btbl.xmlimg)
                 itemtxt = "    <item text="+quote(alltrim(btbl.obj_name))+" icon="+quote(alltrim(imgs[imgno]))+" data="+quote(alltrim(btbl.sortkey))+" onclick="+quote(btbl.sortkey)+" />"
                 Tln(j+". Item Text: ",itemtxt)
                 lst = lst+crlf()+itemtxt	
             else
                  lst = lst+crlf()+"</category>"
                 [COLOR="#FF0000"]'btbl.fetch_next() [/COLOR]need to stay on this record and get the next category
                  goto NEXTCAT
             end if			
             btbl.fetch_next()			
          end while
          Robin

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

          Comment


            #6
            Re: Dynamic Custom XML Toolbox

            Hi Robin,
            very impressed with the toolbar, this is precisely what I have had in mind for our in-house application which is looking a bit dated and in need of tidying up.
            I am slowly working out how this is done but am a bit stuck with your custom function
            Tln("Act Menu Records: ",irecs) . Any pointers would be most appreciated.

            Thanks. Regards Jeff

            Comment


              #7
              Re: Dynamic Custom XML Toolbox

              Very nice toolbar I also am impressed by your work!
              Regards,

              John W.
              www.CustomReportWriters.net

              Comment


                #8
                Re: Dynamic Custom XML Toolbox

                Thanks Jeff & John. The TLN() is just a UDF I created to write messages to the Trace window without having to type out trace.writeln(). Also the action menu is using UDF's to play the commands used for opening the forms, etc. I have modified this since January ( is any work on an app ever done? ). I added an option to display as a 2 or 3 level tree with different images than the xml uses which is selected in the Autoexec. The idea being that I could use the same table format in different apps and just change the data in the menu table. Also I bought a wide screen monitor recently and although this Toolbox looks great on it, on other monitors the lists do not open to display as many selections and have to be scrolled. I haven't been able to resolve this yet. Smaller screens also limit the number of buttons that can be shown at the bottom.
                Robin

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

                Comment


                  #9
                  Re: Dynamic Custom XML Toolbox

                  Hi Robin
                  This is a great improvement on any I have seen so far.
                  Will you publish this latest version?
                  Or sell it as a utility?

                  Comment


                    #10
                    Re: Dynamic Custom XML Toolbox

                    Thought I'd bump my old thread with a new issue. Is it possible to add bubble help to the xml text below?

                    Here is a sample:

                    Code:
                    <<%xml%
                    <toolbox animate="true" type="List" theme="NATIVEWINXP" >
                    <category name="Employees" state="Open" >
                        <item text="Go To EE" icon="$$generic.condition.true" data="Go To EE" onclick="PRA1-01" />
                        <item text="New Hire" icon="$$file.template.new" data="New Hire" onclick="PRA1-02" />
                        <item text="EE Index" icon="$$edit.search" data="EE Index" onclick="PRA1-03" />
                        <item text="Novestaff Forms" icon="$$table.export" data="Novestaff Forms" onclick="PRA1-04" />
                        <item text="Check Register" icon="$$presentation.browse" data="Check Register" onclick="PRA1-05" />
                        <item text="Manual Check" icon="Check_wfb" data="Manual Check" onclick="PRA1-07" />
                        <item text="W/Tax Calculator" icon="$$control.calculator" data="W/Tax Calculator" onclick="PRA1-08" />
                        <item text="EE Custom Letter" icon="$$presentation.form" data="EE Custom Letter" onclick="PRA1-09" />
                    </category>
                    I just now discovered that there is a right click menu available on the open section that offers an icon or list view. The icon view takes less space, but I would need bubble help...
                    Robin

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

                    Comment


                      #11
                      Re: Dynamic Custom XML Toolbox

                      I suppose this topic only interests me - but I found my answer. In the Genie for creating an XD Toolbox, I went thru it again and found there are options available for adding a tooltip as well as onClick AND onDoubleclick events. So all I need to do for my script is first add a tooltip field to my Act_Menu table and then modify my function to give the tooltip an event name which I call from a_dlg_button= statement. I hadn't thought of a good reason to add a doubleclick event in addition to the onclick event before, but now I do! Onclick could perform the action and the OnDoubleclick could open the Help Tree form for the topic; so I could add one more field to the table for the HELP_ID reference.

                      This standalone Toolbox style toolbar is so much easier to work with than the HTML accordion one - at least to me!
                      Robin

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

                      Comment


                        #12
                        Re: Dynamic Custom XML Toolbox

                        I finally got a generic version of my MenuTree app together - I put it in the code archive MenuTree
                        Robin

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

                        Comment


                          #13
                          Re: Dynamic Custom XML Toolbox

                          Originally posted by MoGrace View Post
                          I finally got a generic version of my MenuTree app together - I put it in the code archive MenuTree
                          Robin

                          You get an award for stick toitenous (if I can invent language..)

                          Now take the rest of the weekend off... ;)
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment


                            #14
                            Re: Dynamic Custom XML Toolbox

                            Hi Al,
                            Which only goes to show neither the desktop nor those who use it are dead yet!
                            Robin

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

                            Comment

                            Working...
                            X