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

User defined dock panels

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

    #16
    Re: User defined dock panels

    Ok I found the example. But how were these created? Was a genie used or must one know the xml code? Oh, Lance...
    Robin

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

    Comment


      #17
      Re: User defined dock panels

      Lance,

      Thank you for your great samples.
      I love it and will try.

      Comment


        #18
        Re: User defined dock panels

        Hi Robin,

        Here is a dockpanel that has a analoge clock in it
        Code:
        'Date Created: 22-Apr-2008 03:31:37 AM
        'Last Updated: 22-Apr-2008 03:31:37 AM
        'Created By  : lance
        'Updated By  : lance
        function dp_clock as v ()
        with vars 
        'Notice that the code in this function is wrapped in a 'with vars...end with' statement.
        'Local_variables() are passed in when the function is called. 
        'Because of the 'with vars' statement, this code is executing in the same variable frame as the Xdialog so it can
        'see all of the variables in the Xdialog.
        DIM SHARED cl as T
        DIM cl_Clock as P
        cl=time("",now())
        DIM cl_Clock.events as C = <<%str%
        function onTimeSelect as v (ptr as p)
            
            ' Generated code. Do not delete!
            ' ------------------------------------------------------------------------
            if eval_valid("ptr.variableName") then
                dim sv as p
                sv = session_variables()
                evaluate_template("sv."+ptr.variableName+" = if(typeof(sv."+ptr.variableName+")=\"T\",ptr.time,ptr.shortTime)")
            end if
            ' ------------------------------------------------------------------------
        end function
        
        function onMeridianChange as v (ptr as p)
            
        end function
        %str%
        
        if typeof(cl) = "Y" then
            DIM cl_Clock.shortTime as Y = cl
        else
            DIM cl_Clock.time as T = cl
        end if
        DIM cl_Clock.variableName as C = "cl"
        
        dim dlg_panel_body as c 
        dlg_panel_body = <<%dlg%
        {background=Pale Blue}
        {timer=increment}
        {interval=1}
        {stretch=height,width}
        {TimePicker=40,15cl_Clock}{watch=cl!update_cl_Clock};
        {stretch=}
        {stickto=bottom,left}
        %dlg%
        dim dlg_panel_event as c 
        dlg_panel_event = <<%code%
        if a_dlg_button = "increment" then
        
            cl_Clock.shortTime=time("",now())
        
        
            
        
        end if
        
        
         
        %code%
        'ui_dlg_panel() is like ui_modeless_dlg_box(), except that it is used to launch xdialogs that are hosted in Panels.
        ui_dlg_panel("panel5",dlg_panel_body,dlg_panel_event)   
        end with         
        end function
        Hope this helps you get started, if you are stuck let me know.

        I have several others that are mostly specific to my main database, ie tree menus that call certain jobs and accordian menus that call certain reports. Different staff in our office have different panels on the main menu page to suit their job function

        Comment


          #19
          Re: User defined dock panels

          Hi Lance, I tried creating a script and a function with this code - how to get it to 'run'?
          Robin

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

          Comment


            #20
            Re: User defined dock panels

            dp_clock()
            There can be only one.

            Comment


              #21
              Re: User defined dock panels

              Hi Stan - I did name the function that and tried it from the interactive window. But nothing happens...

              So then I tried removing all blank lines and comments in the XD section - still no go.
              Robin

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

              Comment


                #22
                Re: User defined dock panels

                Robin, (would have replied earlier but am not getting notifications from the message board, which IMO is very bad)

                The dock panels need to be associated with an MDI Xdialog, here is a reworked version of Selwyn's MDI Style Windows script from 'what's new in version 8' in the learning xdialog database. The changes made to get the clock on screen are in RED

                The first time you run it you need to click the task panel item in the menu and turn the clock on. To let the dialog remember the clock details see the
                Code:
                if a_dlg_button= "onactivate"
                section

                The comments in the RED there to help, but if you still get stuck I will try and help. The wiki and other help documentation is not very helpful with this.

                Code:
                'Date Created: 15-Jan-2003 11:09:59 AM
                'Last Updated: 17-Aug-2006 02:47:40 PM
                'Created By  : Selwyn Rabins
                'Updated By  : Selwyn
                
                'Compare this example with the 'mdi_xdialog_framework' script.
                'Notice that in this script you do not need to show and hide the menus and toolbars in the 
                'Activate and Deactivate events as is necessary in 'mdi_xdialog_framework'. In V8, (which introduces the 
                'concept of a session 'context'), you can now initialize the menus and toolbars for the MDI window in the 
                'dialog's 'Init' event. Then, when the MDI looses focus, or is closed, the toolbars and menus are automaticaly hidden
                'or destroyed.
                
                '------------------------------------------------------------------------------------------------------------
                'Important - the a5_toolbar_def_load() function automatically adds the {context} keyword into the dialog string.
                'If you write your own toolbar code (by creating a modeless xdialog with the {dockable} keywork, you must include
                'the {context} keyword in your dialog definition string.
                '--------------------------------------------------------------------------------------------------------------
                
                
                'This Xdialog box script displays a MDI child window.
                'It assumes that you have created a toolbar called MDI_test, and a menu called MDI_test
                'The toolbar should have at least two buttons called "Set Title" and "Close".
                'The event for the "Set Title" button should be "Internal Action" and the event name should be "set_title".
                'The event for the "Close" button should be "Close".
                
                'The menu has two commands, File>Set window title, and File>Close.
                'The xdialog menu string for this menu is:
                
                'File|{DATA=command:set_title}Set window title
                'File|{DATA=command:close}Close window
                
                'Notice that the menu action for each of these menu items is the same as for their corresponding action in the toolbar.
                
                'This script shows that it is possible to launch multiple instances of the MDI child window.
                'Each instance operates independently of the other.
                
                
                'The key to the way in which the toolbar and menu events get executed is the function command() defined at the end of this script.
                'This function sends the events to the Xdialog box.
                
                
                title_var_name = "title_var"+stritran(time(),":","_")
                eval(title_var_name) = "Dialog Title"
                dlg_title = "@="+title_var_name
                
                [COLOR=Red]dim xml_Panels as c 
                xml_Panels = <<%xml%
                <panels>
                    <panel name="Panel5" description="Clock" icon="$$control.clock" install="dp_clock()" />
                    
                </panels>
                
                
                
                %xml%
                
                'Replace the placeholder with the actual dialog title.
                xml_Panels = stritran(xml_Panels,"__dlg_title__",dlg_title)
                [/COLOR]
                
                'This is how we register a new MDI window class so that it appears in the Window menu and the Window menubar.
                'This function takes three arguments: the class name, the class description, and the class icon.
                a5_mdi_windowclass_add("mymdiclass","My Special MDI Window Type","A5_ball_green")
                
                
                
                'This is the event handler string for the Top Menu
                dim event_string as c 
                event_string = <<%code%
                
                if left(a_command,3) = "A5." then   
                   a5.command(substr(a_command,4))
                   a_command = ""
                else if left(a_command,1) = "!" then   
                   evaluate_template(substr(a_command,2))
                   a_command = ""
                else if left(a_command,6) = "addin:" then 
                    evaluate_template(substr(a_command,7))
                else if left(a_command,8) = "command:" then
                    ui_dlg_event(dlg_title,substr(a_command,9))
                else if .not. ("|" $ a_command) then
                   this.command(a_command)
                   a_command = ""
                end if
                %code%
                
                
                [COLOR=Red]dim menu_string as c 
                'Notice that the 'Dock Panels' menu item references a special Alpha Five function, 'a5_dock_panel_top_menu()'
                'This function dynamically creates a menu of all of the installed Dock Panels for this MDI Window.
                'The menu allows you to open any of the installed Dock Panels, close any Dock Panel, or reinstate their default layout (i.e. where they are docked)
                menu_string = <<%txt%
                File|{DATA=command:set_title}Set window title
                File|{DATA=command:close}Close window
                &Dock Panels|{==a5_dock_panel_top_menu()}
                %txt%[/COLOR]
                dim toolbar_string as p 
                toolbar_string = a5_toolbar_def_load("mdi_test") 
                
                
                dim message as c 
                message = "This is a standard MDI child window. It can be maximized, minimized, resized, or restored."
                
                ui_modeless_dlg_box(dlg_title,<<%dlg%
                {icon=A5_ball_green}
                {mdichild=mymdiclass}
                {startup=init}
                [COLOR=Red]{on_activate=onactivate}[/COLOR]
                {text=50,4:Message};
                dlg title [.30title!title_change];
                
                %dlg%,<<%code%
                if a_dlg_button = "init" then 
                    'show the toolbar
                    dim pDummy as p 
                    pDummy.dummy = ""
                    dim contextName as c 
                    contextName = "Mdi_Example" + session_get()
                    
                    'create a new context for menus and toolbars.
                    'any menus and toolbars that are intialized after the context has been created are 
                    'NOT shown when the code that initializes them is executed.
                    'They are shown however, when the context is set.
                    
                    ui_context_create(contextName)
                    toolbar_name = a5_system_toolbar_show(pDummy,toolbar_string)
                    
                    'show the menu
                    'the ui_expand_branched() function is used to expand certain menu 'macros' (such as recent file list, or window list)
                    'at runtime.
                    ui_top_menu(ui_expand_branches(menu_string),event_string)
                    
                    'set the context - this will explicitly display a set of menus and toolbars that have been saved under a 
                    'named context
                    ui_context_set(contextName)
                    
                     
                     [COLOR=Red]   'This is the command that actually loads into memory the Dock Panels specified in the XML string 'xml_panels'
                        ui_context_panels_load(contextName,xml_Panels)
                        
                        'This command restores the position of all Dock Panels.
                        'The position is automatically saved when the MDI window is closed.
                        ui_context_panels_restore(contextName,.t.)
                        'Note: The very first time this script is run, no Dock Panels will be shown until the user explicitly launches them
                        'from the 'Task List' menu item. 
                        'If you want to open Dock Panels automatically when the window is launched for the first time, see commented code below
                        'in the 'onActivate' event handler[/COLOR]
                        
                        
                    
                    'bind the context to the session so that when the session is activated, it automatically does a 
                    'ui_context_set() to show the toolbars and menus that 'belong' to it, and then when the session is 
                    'destroyed, it automatically does a ui_context_destroy() 
                    ui_context_session_bind(contextName)
                    
                        
                end if 
                
                [COLOR=Red]if a_dlg_button = "onactivate"      
                       a_dlg_button = ""       
                       'if flagFirstTimeRun then 
                       '    this is the code to programmatically open a Dock Panel.
                       '    ui_dock_panel_show("Panel1",.t.)
                       '    ui_dock_panel_show("Panel2",.t.)
                       '    set firstTimeRun to .f. and store value somewhere so that it can be read every time this script is run. 
                       '    (you could store it in the registry)
                       'end if 
                end if [/COLOR]
                
                
                if a_dlg_button = "set_title" then 
                    title = ui_get_text("Title","Enter the text for the Window Title")
                    if title <> "" then 
                        eval(title_var_name) = title
                    end if 
                end if 
                
                if a_dlg_button = "title_change" then 
                    eval(title_var_name) = title
                end if 
                
                if a_dlg_button = "close" then 
                    ui_modeless_dlg_close(dlg_title)
                end if 
                %code%)
                
                
                
                
                FUNCTION command as v (  vars as p,command as c ) 'this is the event handler for the toolbar
                with vars 
                if left(command,6) = "event:" then 
                    command = substr(command,7)
                end if 
                ui_dlg_event(dlg_title,command)
                command = ""
                end with
                END FUNCTION
                Last edited by Lance Gurd; 02-17-2011, 04:46 AM.

                Comment


                  #23
                  Re: User defined dock panels

                  Interesting stuff.
                  FYI, for Lance's xdialog to go without error one needs to create a toolbar named "mdi_test". The toolbar can be anything, just for playing around.

                  Raymond Lyons

                  Comment


                    #24
                    Re: User defined dock panels

                    Thank's Ray, Forgot that bit!!

                    Comment


                      #25
                      Re: User defined dock panels

                      What would have been nice in this script is if it was actually the script used in the video where accordion style dock panels were created. I can see that his function for the dock panel is created like a modeless toolbar but then is called into this xml definition. I assume the xml is where the accordion style should be set. Similar code is created when you use the Toolbox style Xdialog genie. But how to map or whatever is is called, to the xml takes a mind reader to understand!

                      Who is it that creates the sales pitch for a new feature that no one can figure out how to do??? I would be happy to have this new accordion style toolbar that can use the same data I populated a tree with. Is it too much to want to know how this can be done? If a simple toolbar can be pointed to the xml and become a dock panel for a midi window, then a modeless toolbar ought to be even simpler to create, then edit, since there is a genie for it.
                      Robin

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

                      Comment


                        #26
                        Re: User defined dock panels

                        a bump -

                        this is from the learning xdialog script:
                        Code:
                        xml_Panels = <<%xml%
                        <panels>
                        <panel name="Panel1" description="Navigation" icon="$$edit.find.next" [COLOR="#FF0000"]install="[/COLOR]ui_dlg_eval('__dlg_title__','dockpanel_1(local_variables())')" />
                        </panels>
                        %xml%
                        And this is from Lance's script:

                        Code:
                        xml_Panels = <<%xml%
                        <panels>
                            <panel name="Panel5" description="Clock" icon="$$control.clock" [COLOR="#FF0000"]install="[/COLOR]dp_clock()" />    
                        </panels>
                        %xml%
                        I don't see how Lance's function would work in this context - but I can't get his function to work anyway. Can anyone explain it to me? That is, what the 'install=' parameter is expecting? It looks like it just needs a pointer to the local variable space to get the dlg_title for the dock panel.

                        I hate to bump an ancient thread, but this one has the most info I've found so far...

                        When you run Selwyn's Dockpanels_Customer script you get a MDI window populated with data from a table and a dock panel.
                        Last edited by MoGrace; 12-24-2014, 08:16 PM.
                        Robin

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

                        Comment


                          #27
                          Re: User defined dock panels

                          It has been a long time since I have looked at this, but it appears that the Install parameter is an xbasic expression that gets run when the dock panel is initialized.

                          the expression
                          ui_dlg_eval('__dlg_title__','dockpanel_1(local_variables())

                          indicates that the docpanel_1() function will be called from the context of the __dlg_title__ xdialog and it will pass in the local variables for that context.

                          i just ran the examples in the sample Learning Xdialog workspace (that ships with Alpha Anywhere) and they work fine - so if you are trying to get your own mdi xdialog window defined, I would start with one of the examples from Learning Xdialog.

                          Comment


                            #28
                            Re: User defined dock panels

                            Merry Christmas Selwyn!

                            The examples in the learning xdialog are fine - as far as they go. I am looking for how to populate the dock panels similarly as to how I can do it with the toolbox action script. There is not enough info in the tutorial to show what the required xml should look like, although Lance seems to have accomplished it, I am still struggling!

                            For my animated toolbox, I created a table that helps to create the menu data and bitmaps and action scripts for the user selections, and a function that uses the table to create the xml. I am wanting to do something similar with the dock panels since they are collapsible - but perhaps not modeless?
                            Last edited by MoGrace; 12-24-2014, 11:38 PM.
                            Robin

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

                            Comment


                              #29
                              Re: User defined dock panels

                              I have all but forgotten all this stuff, as I now solely work on web based stuff. I am willing to send you copies of all the components I worked with back then if that will help.

                              Comment


                                #30
                                Re: User defined dock panels

                                Happy New Year Lance,
                                I know this is old stuff for most, but I am continuing with the desktop and would like to try and use this feature. Pm me and we can try email for whatever you have to send me - it will be much appreciated!
                                Robin

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

                                Comment

                                Working...
                                X