PDA

View Full Version : User defined dock panels


ABC123

Lance Gurd
03-17-2008, 01:41 PM
Anybody played with these yet, they are great. I redesigned my start screen with 3 dock panels over the weekend, they sure knock spots off toolbars. Cant wait for the help file to be produced so that I can work on them in more detail, but what I have done so far makes my front end look very professional.

Big WOW

Selwyn Rabins
03-17-2008, 01:44 PM
Anybody played with these yet, they are great. I redesigned my start screen with 3 dock panels over the weekend, they sure knock spots off toolbars. Cant wait for the help file to be produced so that I can work on them in more detail, but what I have done so far makes my front end look very professional.

Big WOW

glad you like them. for those who have not seen them:

Dock Panels are used extensively in the Alpha Five Script, HTML, Form, Report, Label and Letter editors. Now, you can create your own Xdialog windows with user-defined Dock Panels.
http://www.alphasoftware.com/VideoNewV9/UserDefinedDockPanels.swf

webmaster
03-17-2008, 01:56 PM
Lance, do you happen to have before and after photos? Or at least after? I'd love to see what we can do with the new version.

Lance Gurd
03-17-2008, 02:16 PM
Yes,

After needs some more work to it, and I need to learn all the HTML tags, but it is up and working

NoeticCC
03-17-2008, 03:53 PM
Wow they look great!!! :)

jkletrovets
03-17-2008, 04:08 PM
Very Cool!!

Tim Kiebert
03-17-2008, 06:58 PM
My apologies, but I have missed out on some sleep the last couple of nights and I just can't find the user defined dock panels demo in the learning xdialog sample database as is mentioned at the end of the video. Is it possibly a more recent addition and I just don't have it or am I on the wrong page altogether. If someone could be so kind to point me in the right direction it would much appreciated.

Then again it might be better if I don't find it, otherwise I will get even further behind in my sleep. :)

Selwyn Rabins
03-17-2008, 08:39 PM
My apologies, but I have missed out on some sleep the last couple of nights and I just can't find the user defined dock panels demo in the learning xdialog sample database as is mentioned at the end of the video. Is it possibly a more recent addition and I just don't have it or am I on the wrong page altogether. If someone could be so kind to point me in the right direction it would much appreciated.

Then again it might be better if I don't find it, otherwise I will get even further behind in my sleep. :)

when you intsall an update (as opposed to a fresh install), you don't get new sample databases.

if you do a full install, you get fresh sample databases. but you still have to select 'sample and tutorial databases' on the welcome screen. that's because the version of 'learning xdialog' in your recent files list will have been generated using an older version of the installed sample databases.

Tim Kiebert
03-17-2008, 08:55 PM
Thanks Selwyn,

I will re-download the full Beta.

NoeticCC
03-18-2008, 04:00 AM
when you intsall an update (as opposed to a fresh install), you don't get new sample databases.

if you do a full install, you get fresh sample database
b'sample and tutorial databases.
Ah, I bet that also solves my question about the AJAX examples the help file refers to...

NoeticCC
03-18-2008, 05:53 AM
Ah, I bet that also solves my question about the AJAX examples the help file refers to...

Alas the "What's new in version 9" bit seems absent from the WAS demo... although I could have sworn I've seen it before... odd!

Lance Gurd
03-18-2008, 06:24 AM
Added a couple more task panels, these things are great. Made the greeting time and user sensitive in HTML.

Just need Selwyn to show me how and where to save a task panel, so they can be used globally like the pre-defined ones and I will be away.

Selwyn Rabins
03-18-2008, 02:02 PM
Added a couple more task panels, these things are great. Made the greeting time and user sensitive in HTML.

Just need Selwyn to show me how and where to save a task panel, so they can be used globally like the pre-defined ones and I will be away.

just make a global udf to launch the dock panel.

the examples in 'learning xdialog' have local functions that launch the dock panels, but those functions could just as easily be global functions (i.e. UDFs).

Lance Gurd
03-18-2008, 02:07 PM
of course, thanks Selwyn, sometimes the simplest things are overlooked!!

MoGrace
02-09-2011, 04:44 PM
*bump*

I watched the video and then looked at the Learning Xdialog example where nothing that came close to what the video showed could be found. So Lance - how did you do this? I tried a sample toolbox style XD and wondered how you might dynamically populate the xml variables from a table. Would anybody happen to have a working sample to share?

MoGrace
02-10-2011, 11:08 PM
Ok I found the example. But how were these created? Was a genie used or must one know the xml code? Oh, Lance...

johnkoh
02-11-2011, 10:53 AM
Lance,

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

Lance Gurd
02-14-2011, 04:46 AM
Hi Robin,

Here is a dockpanel that has a analoge clock in it

'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

MoGrace
02-15-2011, 01:43 PM
Hi Lance, I tried creating a script and a function with this code - how to get it to 'run'?

Stan Mathews
02-15-2011, 01:45 PM
dp_clock()

MoGrace
02-15-2011, 01:55 PM
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.

Lance Gurd
02-17-2011, 04:37 AM
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
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.


'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

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)


'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%


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%
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}
{on_activate=onactivate}
{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)


'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



'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

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


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

Raymond Lyons
02-17-2011, 09:04 PM
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

Lance Gurd
02-21-2011, 11:51 AM
Thank's Ray, Forgot that bit!!

MoGrace
03-03-2011, 11:55 AM
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.

MoGrace
12-24-2014, 07:31 PM
a bump -

this is from the learning xdialog script:

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


xml_Panels = <<%xml%
<panels>
<panel name="Panel5" description="Clock" icon="$$control.clock" install="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.

Selwyn Rabins
12-24-2014, 10:39 PM
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.

MoGrace
12-24-2014, 11:31 PM
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?

Lance Gurd
01-02-2015, 09:46 AM
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.

MoGrace
01-02-2015, 01:25 PM
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!