Recent

Author Topic: [SOLVED] spkToolbar and TSpeedButton ?  (Read 2433 times)

scons

  • Full Member
  • ***
  • Posts: 141
[SOLVED] spkToolbar and TSpeedButton ?
« on: July 24, 2017, 10:56:00 pm »
Hi,

I have been doing some tests with the spkToolbar component which is great. Especially if you add it to an expandpanel, you are able to get really close to a "real" Windows style ribbon menu.

To controll te collapse event I was thinking of placing a Tspeedbutton on top (Z-order, Speedbutton to be visible on top of the spkToolBar) of the Expandpanel because a (collapse)button does not exist in the spkToolBar.

Unfortunately the SpeedButton is invisible once it is placed on the spkToolBar, changing the Z-order (bring to front) does not seem to change the visibility.

What do I need to change to get the Speedbutton visible, or to set it on top ?

Thanks
« Last Edit: July 25, 2017, 01:18:36 pm by scons »
Windows 10-64bit Lazarus 2.0.12 + FPC 3.2.0

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: spkToolbar and TSpeedButton ?
« Reply #1 on: July 25, 2017, 12:03:24 am »
Unfortunately the design of TSpkToolbar does not allow arbitrary client controls, only those which come with the component. In fact, the idea to add a control to the Toolbar's parent and move it above the toolbar in z order can be used as a workaround. But it does not work with TSpeedbuttons because they inherit from TGraphicControl and thus cannot be moved along z order. But you could use a panel instead. If you add it to the top bar of the SpkToolbar you can set its Color to the Color of the SpkToolbar, and if you set its BevelInner/Outer to bvNone it is practically inivisble. Then in the OnPaint event you can draw an icon on the panel. Add simple code to create mouse-over or mouse-pressed effects or to switch from a collapse to an exand icon.

Just look at the right "button" in the top toolbar row of the attached demo. Click it.

But of course, in the long term, SpkToolbar should be extended to provide some extra buttons in the top bar. Patches are welcome.

scons

  • Full Member
  • ***
  • Posts: 141
Re: spkToolbar and TSpeedButton ?
« Reply #2 on: July 25, 2017, 11:35:00 am »
Thanks for explaining that with a Panel it works (like a charm).

Now that this works I created some Windows lookalike image for it, for those who want to use them, they're free.
Windows 10-64bit Lazarus 2.0.12 + FPC 3.2.0

 

TinyPortal © 2005-2018