Author Topic: Can't create a dockable toolwindow  (Read 6375 times)

Graeme

  • Senior Community Member
  • Posts: 2816
  • Hero Points: 347
Can't create a dockable toolwindow
« on: August 23, 2014, 10:17:13 AM »
V19 won't let me create a dockable toolwindow.  If I do "show mytoolbar1" for the following form, I get a visible toolwindow but I can't dock it and mostly it can't be dragged around the screen either.  In the options dialog it appears in the list of "toolbars" and not in the list of "toolwindows" and in the main editor window, it doesn't appear in either view -> toolbars or view -> toolwindows lists.

Code: [Select]
#include 'slick.sh'
#include 'toolbar.sh'
_form mytoolbar1 {
   p_backcolor=0x80000005;
   p_border_style=BDS_SIZABLE;
   p_caption='My Toolbar 1';
   p_CaptionClick=true;
   p_clip_controls=false;
   p_forecolor=0x80000008;
   p_height=180;
   p_tool_window=true;
   p_width=1755;
   p_x=7890;
   p_y=0;
   p_eventtab2=_qtoolbar_etab2;
   _image  {
      p_auto_size=true;
      p_backcolor=0x80000005;
      p_border_style=BDS_NONE;
      p_forecolor=0x80000008;
      p_height=405;
      p_max_click=MC_SINGLE;
      p_message='On a toolbar, right-click and select "Properties..." to customize.';
      p_Nofstates=2;
      p_picture='bbtool01.ico';
      p_stretch=false;
      p_style=PSPIC_HIGHLIGHTED_BUTTON;
      p_tab_index=1;
      p_value=0;
      p_visible=false;
      p_width=405;
      p_x=0;
      p_y=0;
      p_eventtab2=_ul2_picture;
   }
}

defmain()
{
   _config_modify_flags(CFGMODIFY_RESOURCE);
   _tbAddForm("mytoolbar1",TBFLAG_NEW_TOOLBAR|TBFLAG_ALWAYS_ON_TOP|TBFLAG_SIZEBARS,false,0,true);
}

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Can't create a dockable toolwindow
« Reply #1 on: August 24, 2014, 09:57:57 PM »
TBFLAG_SIZEBARS is no longer supported. Remove it and re-run the batch macro.

++rodney

Graeme

  • Senior Community Member
  • Posts: 2816
  • Hero Points: 347
Re: Can't create a dockable toolwindow
« Reply #2 on: August 25, 2014, 02:47:13 AM »
TBFLAG_SIZEBARS is no longer supported. Remove it and re-run the batch macro.
If I remove TBFLAG_SIZEBARS it creates a toolbar, not a toolwindow.  I need a re-sizeable toolwindow.


Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Can't create a dockable toolwindow
« Reply #3 on: August 25, 2014, 05:05:03 AM »
Your form had a single button, and set p_eventtab2=_qtoolbar_etab2. If it walks like a duck, and quacks like a duck, etc., etc.. ;-)

Maybe you meant to post something else?

In any case, if you really want to make it a tool-window, then you should set p_eventtab2=_toolwindow_etab2, and register it with:

#include "se/ui/toolwindow.sh"
...
int flags = 0;
DockAreaPos preferredArea = DOCKAREAPOS_NONE;
tw_register_form('mytoolbar1', flags, preferredArea);

Also, your _image "button" initially sets p_visible=false, so there will be nothing visible when the window is shown. Anyway, there you go.

++rodney

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Can't create a dockable toolwindow
« Reply #4 on: August 25, 2014, 05:08:15 AM »
Oh, and if you need to clear that tool-window, you can reset everything via 'reset_window_layout' on the SlickEdit commandline.

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Can't create a dockable toolwindow
« Reply #5 on: August 25, 2014, 05:15:43 AM »
And if you need a resizable tool-window (i.e. one that can rearrange its children), then you need to implement an on_resize() event-handler for your form. Look at some of the other tool-window event handlers for examples.

Graeme

  • Senior Community Member
  • Posts: 2816
  • Hero Points: 347
Re: Can't create a dockable toolwindow
« Reply #6 on: August 25, 2014, 09:57:28 AM »
ok, thanks.  Sorry to confuse you but I was confused and frustrated myself.  I have my own files toolbar which uses a toolwindow and is several thousand lines.  A few weeks ago I was looking into how to get it to set itself up without having to go through "new toolwindow/toolbar" via the menus.  I discovered in the appendix in the help file that you can do this
_tbAddForm("mytoolbar1", TBFLAG_NEW_TOOLBAR,false,0,true);
The appendix refers to a file called newToolbar.e which is supposedly in docs/samples installation folder - but it isn't there.  However I got the file from slick support a few weeks ago and when I couldn't get my own files tool-window to function as a tool-window in V19 I turned to the simpler newToolbar.e to see if I could make that function as a tool window.

To cut a long story short it looks like in V18 my code wasn't even gonna work correctly anyway so thanks very much for telling me how to create a tool-window.  Maybe you could update the help file to explain it there too.  In the help file slick c macro programming guide section there's a topic called "creating dialog boxes".  Maybe there could be a new section called "Creating toolbars and tool-windows" with the information you've just given me  - especially as you can't create a tool-window through the menus any more.

Just remembered, when I click the X (close) button at the top right of my tool-window in V19, it doesn't close.  I can close it by un-docking and clicking X though - so it doesn't really matter - i.e. I don't need a solution as I hardly ever close it, just letting you know.