Alpha Video Training
Results 1 to 13 of 13

Thread: Dynamic Tree Menu System using Xdialog Supercontrol

  1. #1
    "Certified" Alphaholic
    Real Name
    Jeff Kletrovets
    Join Date
    Oct 2005
    Location
    Columbus, OH
    Posts
    1,135

    Default Dynamic Tree Menu System using Xdialog Supercontrol

    Hi All

    I thought I would share this with the community in case someone else might benefit from it. After reading Peter Greulich’s post about a tree menu system he has created and Bob McGraffic’s excellent post in the code archive about how to use an activex control for creating a tree menu system, I decided to try and create my own using the embedded Xdialog Supercontrol in v9. The tree control used in the xdialog allows the use of open and closed icons (something the regular form tree control cannot do). The result of my tinkering is what you see here.

    Attached are some screen shots as well as the zipped database.

    Items of note:

    1. The TreeMenuForm form shows the embedded xdialog. The menu shown is set by a global variable called gvuser in the autoexec script. In my normal apps I have a login routine that sets this variable.
    2. You can test the dynamic nature of the menu by closing the TreeMenuForm and opening the DynMenuBrws_frm and changing the “Allowf” choice from the one that is “F” (false) to true for terir. Now open the TreeMenuForm again and you will see that menu item.
    3. There is a “master menu table” that is the template for all new menus as well as to update the menus that were previously created.
    4. There is a button on the DynMenuBrws_frm to add a new menu for a user. When prompted enter the userid for the new user and a new menu system will be created for them. You can then use the dropdown to filter the browse to edit the menu choices for that user. Remember: if you want to see that menu then you need to set the value of gvuser to the new userid you just created .
    5. There is another button on the DynMenuBrws_frm that will let you update the menu for the user you are viewing in the likely event you make a change to the “Master Menu” table and now want those menu items over in the Dynamic Menu table.
    6. You will notice that the icons (see screenshot) for all the administrative level are the same. This is VERY important to get the tree to show correctly. Since the tree Xdialog is built from a string – the string value at this top menu level must be the same if you want one entry for “Administrative”. If you were to have different open and close icons for each entry for this level then the tree shows a branch for each of those because it needs a place to display the different open and closed icons. When they are the same then the tree shows them under one branch as you would expect
    7. The menu system framework I have created is 3 levels deep.
    8. The icons you see in the DynMenuBrws_frm form are embedded in the table for easy showing in the browse – this aids in setup. I know this is not “Best Practice” but for this use I think it is fine since there will be relatively a small number of icons. You will notice I also store the filename of the icon for each choice. This text is used in the creation xdialog tree string.
    9. Each menu item has control panel name and type. This tells the menu what to do with the choice if the user selects it. Pay no attention to what runs when you select the item – they are not what the items say – they are just for testing.
    10. The icons I have chosen are gotten to when you use the edit button on the DynMenuBrws_frm. You can see you will be presented with the dialog box letting you choose from the internal images (or image from your own library you attach to this database).
    11. There is not much error checking or polish with this example because everyone’s implementation is likely to be different but there is a solid core I believe to making your own dynamic menu system that is appealing to the eye.
    12. Always start form the highest level and go down. For example, do not enter level one information and then no level 2 information – but then you enter level 3 information for a menu item
    13. You DO NOT have to enter an open and closed icon for each menu choice. If you only want one icon for a menu choice then just add a “Closed Icon” for that level. The code will take care of showing the tree properly. This would be common if you did not have 3 levels and the 2nd level was the actual menu choice – obviously you don’t need an opened icon since once you click on it you will be going to the form or report you chose.

    I am probably forgetting something….hope not…..I hope this is useful for the Alpha Community.

    Regards,

    Jeff

  2. #2
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,785

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Nice, well done, and thanks for sharing.
    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.

  3. #3
    "Certified" Alphaholic
    Real Name
    Jeff Kletrovets
    Join Date
    Oct 2005
    Location
    Columbus, OH
    Posts
    1,135

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Attached is an update that does away with the user having to click a button to go to the menu choice. They will now be taken to their choice when they click on the tree item - which is more what one would expect.

  4. #4
    Member
    Real Name
    Geoff Meredith
    Join Date
    Aug 2006
    Posts
    637

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Jeff - thanks for the example. You mentioned the inspiration was partly from Peters thread. In that thread there was the need to expand all tree nodes. This is something I would like to do.

    When my form is first opened I want all the tree nodes to be expanded.

    Do you know how this can be achieved with your example?

    Cheers

    Geoff

  5. #5
    "Certified" Alphaholic
    Real Name
    Jeff Kletrovets
    Join Date
    Oct 2005
    Location
    Columbus, OH
    Posts
    1,135

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Sure thing Geoff....

    Yep...to fully expand all the nodes you need to just add one more directive into the xdialog definition. You need to just add an "X" to the list of directives.

    An Example:

    Code:
    'IMPORTANT: Do not change the dialog title.
    ui_modeless_dlg_box(dlgTitle,<<%dlg%
    {background=<Transparent>}
    {font= arial, 11}
    [%S=BLRX;D="^"%.140,80vdocchoice^<auto_list_vdocchoice!refdocchoice_*];
    %dlg%,<<%code%

    Look at the "S" directive and the "BLRX.....". That'll get it done for you.


    Regards,

    Jeff

  6. #6
    Member
    Real Name
    Geoff Meredith
    Join Date
    Aug 2006
    Posts
    637

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Cheers Jeff.

    I was expecting to have to do some sort of loop to have to get them to open. Can't get any easier than just adding one letter. I need to delve deeper into using xdialog. So far I have only used the genie for a few simple things and haven't really dabbled with any of the code it produces.

    Thanks

    Geoff

  7. #7
    Member
    Real Name
    Dave Ferrasci
    Join Date
    Apr 2012
    Posts
    2

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Hi
    I am new to Alpha 5
    I like this menu system but I see 2 problems and would like to know if anyone has had this problem

    1. You can choose the same item 2 times in a row you must move another item between them
    2. When selecting a report it dispays 2 times

    I am do have enought experance yet to see where the problem has anyone had any luck fixing this?

    with that said I relay like this and would like to use it

  8. #8
    "Certified" Alphaholic
    Real Name
    Jeff Kletrovets
    Join Date
    Oct 2005
    Location
    Columbus, OH
    Posts
    1,135

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Hi Dave

    Welcome to Alpha!

    I have tweaked this menu significantly for my use since I posted this example.

    I have not looked at the code from the example in a long time.

    As far as item one of your questions, just find the code that that says "IF a_dlg_button = "menuitem_change" and replace it with the line below.

    IF a_dlg_button = "menuitem_change" .OR. a_dlg_button = "menuitem_dblclick"

    I don't understand what you are saying with your second question. Can you explain further? I am sure whatever the issue is can be resolved for you. I have approx 150 users using this menu system in various apps and I have not had any problems so I should be able to help you.

    Regards,

    Jeff

  9. #9
    Member
    Real Name
    Dave Ferrasci
    Join Date
    Apr 2012
    Posts
    2

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    thank you for your answer

    on the questions # 2
    when i setup a report and select it it displays the report then dispalys it again
    wired

    I dont know

    Dave

  10. #10
    VAR
    Real Name
    Ozgur Ugur
    Join Date
    Jul 2006
    Location
    Izmir, Turkey
    Posts
    28

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Jeff,

    is there any updated version of your code which you can share with us?

    Thanks,
    Ozgur
    Ozgur Ugur
    Computer Eng.
    Data Yazilim Ltd.
    Izmir - Turkiye

  11. #11
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Jeff
    Thanks for the share.
    Your update in post #3 makes a big difference.
    I just took a look through it today and well done.
    I had looked at your previous version a while back.

    BTW
    IF a_dlg_button = "menuitem_change"
    is found only in the listcolor test
    Do you inherently give permisssion for use in an app?

    Ray

  12. #12
    "Certified" Alphaholic
    Real Name
    Jeff Kletrovets
    Join Date
    Oct 2005
    Location
    Columbus, OH
    Posts
    1,135

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Hi Ray,

    >>Do you inherently give permisssion for use in an app?

    Yep...for sure.

  13. #13
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Re: Dynamic Tree Menu System using Xdialog Supercontrol

    Thanks Jeff
    I appreciate that.
    Ray

Similar Threads

  1. Replies: 4
    Last Post: 04-28-2008, 10:14 AM
  2. Dynamic length Xdialog
    By Mike Wilson in forum Alpha Five Version 7
    Replies: 4
    Last Post: 01-21-2007, 11:25 AM
  3. Search the Tree Menu? Possible?
    By Marc King - A5solutions in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-10-2004, 09:39 AM
  4. system menu - system toolbar
    By Doug Chanley in forum Alpha Five Version 5
    Replies: 2
    Last Post: 12-01-2003, 05:26 PM
  5. Dynamic filter in XDialog box
    By Jay Talbott in forum Alpha Five Version 5
    Replies: 6
    Last Post: 05-22-2003, 01:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •