Recent

Author Topic: Floating and docked toolbars  (Read 5204 times)

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Floating and docked toolbars
« on: August 14, 2017, 08:30:03 pm »
Hi all!
I try create a customizable in runtime toolbars (docked and floating) http://svn.shamangrad.net/zcad/trunk/cad_source/components/ztoolbars/ example of usage of this http://svn.shamangrad.net/zcad/trunk/cad_source/components/ztoolbars/examples/umainform.pas This is the beginning, therefore so many problems((
Using this and AnchorDocing package you can build a fully customizable gui interface without app recompiling.
I guess it would be interesting to someone else. It is very strange that after so many years of Lazarus existence floating toolbars are not implemented yet. Probably I badly searched

upd: you need trunk lazarus and fpc for use this
« Last Edit: August 15, 2017, 12:55:25 pm by zamtmn »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Floating and docked toolbars
« Reply #1 on: August 14, 2017, 08:44:55 pm »
have you see this one https://github.com/x2nie/flying-toolbar?I have it bookmarked but never looked at the code so can't really recommend it.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #2 on: August 14, 2017, 09:10:40 pm »
I look it once upon a time. It's dependency with third party libs (GR32), complicated and unfinished, to finish it is not real for me.
I hope to do with standard LCL classes - TToolBar and TCoolBar. My code only implements reading- writing to XML, and some LCL patchs https://bugs.freepascal.org/view.php?id=32027
« Last Edit: August 14, 2017, 09:18:22 pm by zamtmn »

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #3 on: August 15, 2017, 05:25:09 pm »
Already done and works:
-Load toolbars content from the simple XML format (example http://svn.shamangrad.net/zcad/trunk/cad_source/components/ztoolbars/examples/bin/toolbarscontent.xml)
-Runtime load toolbars layout from the simple XML format (example http://svn.shamangrad.net/zcad/trunk/cad_source/components/ztoolbars/examples/bin/toolbarslayout.xml)
-Save toolbars layout
-Simple register your own toolbar and toolbar items (bottons, combos...) classes
-Runtime toolbars positioning (float and docked to coolbars, vertical and horisontal)

Required, but not done:
-Prevent stealing focus from the main form

As I understand, last point is impossible made by LCL, only platform specific methods.

A screenshot of the test application is attached. I didn't use bitmaps, so on the toolbar buttons text not the icons

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Floating and docked toolbars
« Reply #4 on: August 15, 2017, 07:34:49 pm »
I look it once upon a time. It's dependency with third party libs (GR32), complicated and unfinished, to finish it is not real for me.
As far as I can see there are ifdefs to disable graphics32, but I'm inclined to take your word at this point.
Required, but not done:
-Prevent stealing focus from the main form

As I understand, last point is impossible made by LCL, only platform specific methods.
actually it might be the opposite, In order for an unfocused "popup" window to work, the form needs to have a "popup form" property to forward keyboard events to it and continue processing keys that are not processed by it, The "popup form" must have a "parent form" property to swift its focus to, when it gets it.
As a side note, the FPGUI developer claims that he has a popup form that behaves properly I would suggest to take a look and see if that helps at all.

Looking good so far. I have to download and check it out some time.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #5 on: August 15, 2017, 09:09:19 pm »
>>the form needs to have a "popup form"
I think in most cases TСontrol.OnMouseActivate enough, in Delphi it is a long time there
https://bugs.freepascal.org/view.php?id=32246

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #6 on: August 17, 2017, 10:19:33 pm »
I don't understand:
Code: Pascal  [Select][+][-]
  1. procedure TCustomCoolBar.WMSize(var Message: TLMSize);
  2. begin
  3.   //DebugLn('WMSize');
  4.   inherited WMSize(Message);
  5.   if not Autosize then begin
  6.     CalculateAndAlign;
  7.     Invalidate;  //required by GTK2
  8.   end;
  9. end;
Why CalculateAndAlign call only if not Autosize? It's wrong, it must be called for any CoolBar resizing

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Floating and docked toolbars
« Reply #7 on: August 17, 2017, 10:55:18 pm »
I don't understand:
Code: Pascal  [Select][+][-]
  1. procedure TCustomCoolBar.WMSize(var Message: TLMSize);
  2. begin
  3.   //DebugLn('WMSize');
  4.   inherited WMSize(Message);
  5.   if not Autosize then begin
  6.     CalculateAndAlign;
  7.     Invalidate;  //required by GTK2
  8.   end;
  9. end;
Why CalculateAndAlign call only if not Autosize? It's wrong, it must be called for any CoolBar resizing
I'm guessing because calculateAndAlign also changes the size of the coolbar and if it is not autosized that should not happen.I'll take a closer look on what it does later probably tomorrow.
« Last Edit: August 17, 2017, 10:57:27 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #8 on: August 17, 2017, 11:27:10 pm »
CalculateAndAlign - only align CoolBands inside CoolBar, dont change CoolBar size.
If remove
Code: Pascal  [Select][+][-]
  1. if not Autosize
everything works better

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #9 on: August 18, 2017, 12:36:19 am »

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #10 on: August 19, 2017, 07:16:54 pm »
I create issue about TCustomCoolBar.WMSize https://bugs.freepascal.org/view.php?id=32299

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #11 on: February 16, 2018, 07:45:34 pm »
Add new DockedAppWithToolBars example - application with docking and toolbars. Forms are easily added\removed by registering in the application

zamtmn

  • Hero Member
  • *****
  • Posts: 594
Re: Floating and docked toolbars
« Reply #12 on: April 22, 2023, 06:18:34 pm »

 

TinyPortal © 2005-2018