Alpha DevCon 2018
Results 1 to 13 of 13

Thread: A5 Toolbar - is there a way to remove items from view as opposed to disabling

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

    Default A5 Toolbar - is there a way to remove items from view as opposed to disabling

    I use a left dock Alpha toolbar for user navigation.
    In my programs there are different methods that various clients employ to do their billing.
    With new clients, adding new options and disabling others, using Alpha's toolbar, is easy enough but raises questions from others, as well as there not being enough space for many disabled items.

    Because accounting and other functions behind are the same future enhancements apply to all customers, I maintain one system.

    I know there are methods to create dynamic menus but none I have tried have the compact width and other features of Alpha's. One being the different shade for options already open.

    Is it possible to get the Xdialog code?
    or anyone know of commands to have items not show?
    OR anyone with another solution to offer or sell?
    Last edited by Ray in Capetown; 10-22-2013 at 02:48 AM.

  2. #2
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,844

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Ray,
    Can't you copy the a5 toolbar to one of your own name, then customize it to your liking? Your copy would then have the compact look, but would also be customizable.

    Tom

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

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Hi Tom
    I create the menus using New Menu from the Program tab in A5 control panel.
    The attached pic is an example.

    I disable menu items dynamically in code according to a table setting for each specific client depending on the type of business.
    These still however show and take up screen real estate.

    Some clients bill rentals, pass on services costs, another may bill on contract schedule and added services, others recover costs by billing .... but not all do every type of billing.

    If I could convert this menu to Xbasic/XML code then I could conditionally, in the code, skip certain options and the user will never see them.

    As mentioned I have tried various dynamic dialog menus and toolbars but they dont have all the functionality, like here items that have windows open remain highlighted (such as the Home Menu in the pic) and there is no frame around taking additional space.

    I suppose I could have individual menus called according to data but to distribute changes to the system usually means re-creating menus with in/excluded functions for each client.
    Attached Images Attached Images

  4. #4
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    135

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Found this thread while searching for a way to do this myself. In the end I found a way to accomplish this. I figured I would share my solution for anyone else you finds this thread.

    Background:
    As finish up my application for deployment with the Run Time I am implementing custom MenuBars and ToolBars. One of the options I have removed from these menus is the Design Mode button. However shortly after doing this I realized I did use this button quite a bit. So wouldn't be nice if it only showed up in the menu or ToolBar if NOT using the Run Time. I realize I can disable it but I don't want the end user seeing this greyed out button all the time.
    As it turns out MenuBars are just a Xdialog code with special markers that are interpreted to allow for proper formatting depending on orientation etc.


    Solution:
    - Add the to ToolBar the button you want to make conditionally appear. The latter steps will be easier if the toolbar only has a few buttons at this point.
    - Add an Enable Expression.
    - It would be best to test the toolbar to verify the enable expression works as expected before getting fancy.
    - In the Toolbar editor go to the Toolbar Appearance Tab
    - Use the Show Xbasic button on the button right of the screen (your changes will not appear in this screen till you save the ToolBar)
    - In the Dialog Body region locate the Xdialog code for the button you want make optionally visible. In my situation it was part of the following 3 lines;

    #LINE#
    #SP#{Font=}{tag=3}<%B=System;T=Design Mode;I=$a5_triangle;%!!script_text:a5_sec_topparent_command("SYSTEM_DESIGN", "design")?topparent.restrict_edit=.f..and.a5_is_runtime()=.f.>
    #LINE#

    - Copy out the part we are interested in which is just the button definition. Once again in my case;

    <%B=System;T=Design Mode;I=$a5_triangle;%!!script_text:a5_sec_topparent_command("SYSTEM_DESIGN", "design")?topparent.restrict_edit=.f..and.a5_is_runtime()=.f.>

    - exit the Xbasic dialog and return to the Toolbar Buttons Tab
    - Add an XD Free-form Xdialog button to your toolbar. This button will eventually replace the first instance of the button.
    - Click the Define Xdialog Code button
    - Insert the button definition obtained above adding the two Conditional Xdialog statements as shown below.
    - The conditional statement from the button or part of it is transferred to the first of the added statements as the conditional.

    Code:
    {staticConditionalSection:1:a5_is_runtime()=.f.}
    <%B=System;T=Design Mode;I=$a5_triangle;%!!script_text:a5_sec_topparent_command("SYSTEM_DESIGN", "design")?topparent.restrict_edit=.f.>
    {end_staticConditionalSection:1}

    - In my case the Design Button completely disappears when the Toolbar is displayed in the RunTime.
    - If you go back to Xbasic view you will now see your custom code in the definition. While you can directly edit the Xbasic code your edits are undone when you go to save the Toolbar, I tried.
    Last edited by pboomwork; 04-04-2015 at 10:45 PM.

  5. #5
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    135

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Using the method in the above post you can easily increase the size of the [Record Number Selector].

    Just enter the following code in a XD Free-form Dialog.

    Code:
    {region} 
    {on_key=enter!recno_selector_enter} 
    {watch=topparent.Current_Record()!recno_changed} 
    [%*%.8a5_recno!goto_record?flag_odbc_table=.f.]; 
    {endregion}
    The number 8 in the above code is the width of the box. Make it as wide as you need to display really large number of records.

  6. #6
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    135

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Just added another useful button to my standard form toolbar. This one will hide and unhide the control panel and the code editor if it is open. Once again this button only is visible if NOT in the run time.

    Just add the following code to a XD Free-form Xdialog button.

    Code:
    {staticConditionalSection:1:a5_is_runtime()=.f.}
    <%B=System;T=Hide/Unhide Control Panel and Code Editor;I=$$window.controlPanel;%!!script_play_local("ZControlPanelOnOff")>
    {end_staticConditionalSection:1}
    This code runs the following script

    Code:
    '------------------
    'zControlPanelOnOff
    '------------------
    'Toggles the Control Panel and code editor between visable and activated and hidden
    IF ControlPanel.IsVisible()
    	ControlPanel.hide()
    	IF is_object("Code_Editor")
    		Code_Editor.hide()
    	end if
    else
    	ControlPanel.Show()
    	ControlPanel.Activate()
    	IF is_object("Code_Editor")
    		Code_Editor.Show()
    	end if
    end if

  7. #7
    Member
    Real Name
    Craig Schumacker
    Join Date
    May 2000
    Posts
    684

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Paul:

    As long as we are on the topic of enhancing a toolbar....

    Do you know of a way to refresh the toolbar? For example, if I had a login button on a toolbar, it would be nice to replace that button with a logout button after logging in. Then, reversing on log out.

    The perfect scenario would be a refresh, not closing and reopening the toolbar.

    Also, do you know of a way to put ActiveX on a toolbar? For example, an Adobe Flash object?

    That would be pretty neat...

    Regardless, thanks for posting what you have already. It will likely be handy.

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

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    I am trying to follow your explanation.
    What does -
    Copy out the part we are interested in which is just the button definition
    mean? Cut or copy?
    What is the Record Number Selector you refer to in post #5?

  9. #9
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    135

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Button definitions in xDialog are inclosed with the less then < greater than > signs. As stated in my original explanation the Button definition in my sample is;

    <%B=System;T=Design Mode;I=$a5_triangle;%!!script_text:a5_sec_topparent_command("SYSTEM_DESIGN", "design")?topparent.restrict_edit=.f..and.a5_is_runtime()=.f.>

    This Jumble of characters defines a single button on the toolbar. It is standard Xdialog code. Search the help system for Xdialog, Button Syntax for more information on this.

    I located the button definition already created to use in the new button that I would be making conditionally disappear in the Toolbar. The new button I made conditionally disappear is created as a XD Free-form Xdialog button. The XD Free-form Xdialog buttons allows additional Xdialog code to be added that will conditionally insert the button definition in the the Toolbar.

    It can be hard to locate the button of interest as it all looks like a jumble of letters, hence my advice on trying this with a simple Toolbar first. Also adding names to the Toolbar buttons will make locating them easier.

    The two statements below are documented in the whats new in version 10 files. This only appears to work in Version 10.5 with the latest patch applied.

    {staticConditionalSection:1:CONDITION}
    {end_staticConditionalSection:1}

    To reiterate I used a button definition that is created and tested as a standard button with an enable/disable expression. This button definition is then used to create a new button that conditionally disappears.

    The Record Number Selector refer to in post #5 is shown in the image below. This box shows the current record but you can also type in a record number and press enter to select that record. Other post indicate that if you have over 1 million records the number will not completely fit in the box depending on your OS and default fonts. Post 5 explains how you can replace the box with one of your own making that is bigger.
    4-5-2015 11-50-33 PM.png
    Last edited by pboomwork; 04-06-2015 at 09:24 AM. Reason: Answer 2nd part of question.

  10. #10
    Member
    Real Name
    Paul Verboom
    Join Date
    Apr 2006
    Location
    Halifax, Nova Scotia, Canada
    Posts
    135

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    In response to Post #7

    As I stated in the original post Toolbars are just Xdialog code with special formatting characters added that allow A5 to reformat the Toolbar depending on where it is docked, horizontal, vertical, floating, etc. The XD Free-form Xdialog button type allows you to embed any Xdialog code in the Toolbar. If you can find a way to refresh a Xdialog from within the xdialog this should be possible, but I don't know what that would be. You most likely will need to use event code which is supported for the XD Free-form Xdialog buttons.

    Just ran across the following method <OBJECT>.TOOLBARCHANGE() where <object> is a pointer to a form or browse. This should provide a way to reload the current toolbar or a different one without the Login Box.

    It possible to embed ActiveX controls in an Xdialogs so it should be possible to add it to a Menubar. I would attempt to get your ActiveX control working in a standard Xdialog then try adding it to a Menubar.

    Please let everyone know if you succeed in doing this.
    Last edited by pboomwork; 04-06-2015 at 10:28 AM.

  11. #11
    Member
    Real Name
    Craig Schumacker
    Join Date
    May 2000
    Posts
    684

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    I will let you know. I suspect it is possible, too, just never did it. It's been an idea twirling in the corners of my mind for a couple months, but I have not had time to indulge myself in the theory.

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

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Great explanation Paul.
    Thanks

  13. #13
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,468

    Default Re: A5 Toolbar - is there a way to remove items from view as opposed to disabling

    Question on Post #6 - where did you put the script for the button event to show/hide the control panel?

    Edit: Nevermind. If I could read, I would have seen that it is a saved global script...

    The buttons do not align properly on my toolbar, but for the developer copy this is a great option to have.

    Thanks, even if a bit late!
    Last edited by MoGrace; 04-15-2018 at 01:11 PM.
    Robin

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

Similar Threads

  1. browse design view toolbar
    By noviceuser in forum Alpha Five Version 11 - Desktop Applications
    Replies: 4
    Last Post: 08-31-2012, 07:41 PM
  2. adding line items in a form or detail view
    By zengraft in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 05-23-2011, 07:20 PM
  3. Detail View ToolBar
    By jacklcs22 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 08-17-2010, 01:56 PM
  4. Form View Toolbar
    By Thiazi in forum Alpha Five Version 7
    Replies: 3
    Last Post: 01-03-2008, 07:17 AM
  5. Disabling a toolbar with Xbasic
    By drgarytraub in forum Alpha Five Version 5
    Replies: 4
    Last Post: 07-25-2002, 05:36 PM

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
  •