Recent

Author Topic: spkToolbar evolution  (Read 7411 times)

husker

  • New Member
  • *
  • Posts: 20
spkToolbar evolution
« on: September 23, 2020, 07:34:31 pm »
Hello to all forum members,

I've added separators items to spkToolbar component. 2 sizes of separators are now available (large and small), as you can see on attached screenshots of the modified "actions" demo.

The changes are mainly a new ButtonKind (bkSeparator) added on TspkLargeButton and TspkSmallButton, and modifications to handle it on the necessary procedures (those that deal with drawing and size calculations).

You'll find attached the modified "spkt_Button.pas" unit (the only one I change beside demo), and if someone could "upload" it (or merge the changes) in the repository, that would be great :). All changes are commented out, starting with "// Husker". if needed, I can upload also the modified demos, or the whole package, if someone tell me how to do (the attachments size and number limitation, you know :-[...)

To be honest, I'm a hobbyist developer that only play with Lazarus, reminding me the old days when I did the same thing with Delphi Personal Edition, almost 10 years ago, and I don't know how to use SVN and all this sort of thing. As I don't want and have time to learn how to use them, I think it's better spending time trying to improve components than fighting with SVN stuff...

Last precision : I work on Windows 10 1903, and haven't tested the changes on other platforms as I don't have access to them.

Feel free to give me feedback or comments.

Regards,

Husker

« Last Edit: September 23, 2020, 07:38:04 pm by husker »
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

AlexTP

  • Hero Member
  • *****
  • Posts: 2365
    • UVviewsoft
Re: spkToolbar evolution
« Reply #1 on: September 23, 2020, 08:03:48 pm »
You can
-create account on GitHub
-create new repo there "spkToolbar"
-don't install git! Go to your repo, and use web site to Make new file (button "Add file" above file list), to Edit it later, etc. All via browser!

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #2 on: September 23, 2020, 08:47:07 pm »
Wouldn't this create a sort of alternate version of spkToolbar ? Moreover, it won't be accessible via the Online Package Manager ? I see that the current package is hosted on Sourceforge, not on GitHub...
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: spkToolbar evolution
« Reply #3 on: September 23, 2020, 09:18:22 pm »
Thanks for this nice contribution. Good to see that people are taking the time to dig into lots of code.

I applied your changes to the current trunk version on CCR; I modified a few places to activate high-dpi scaling of the new lateral dimensions.

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #4 on: September 23, 2020, 09:42:45 pm »
Thanks for the uploading of the changes, wp :).

When I used Delphi PE 10 years ago, I enjoyed time spend to understand how the components worked, and creating new ones as exercises for me. I think I have the same kind of great time to do the same thing using Lazarus :).

spkToolbar interests me a lot: it's a good attempt to mimic the Windows ribbon, without using anything from the original library. I'm pretty sure that some things are not possible to mimic (quick access toolbar in window title, contextual tab with "titlebar overlay tab") at least for my programming skill, but maybe it's possible to add some more stuff.

I'll know dig in the drawing and position of the tabs, just to see if it's possible to push them a little bit on the right side, to leave space to add a sort of "menu button".
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #5 on: September 23, 2020, 09:56:06 pm »
wp,

Just found how to see the changes you commited to the repo. I haven't thought to put the new constants in the correct unit, this is better like this :). Also, I've seen the changes you have made to support hi-dpi scaling. I don't know the purpose of this, something more to dig in :) !

Always happy to learn, thanks a lot.
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: spkToolbar evolution
« Reply #6 on: September 23, 2020, 10:28:22 pm »
I've seen the changes you have made to support hi-dpi scaling. I don't know the purpose of this, something more to dig in :) !
Since v1.8 Lazarus is supporting automatic scaling of sizes to the current screen resolution. While everything is done automatically for the built-in controls, third-party components must take care of scaling their inner dimensions themselves. For this purpose, the method DoAutoAdjustLayout must be overridden to apply the scaling factor (https://wiki.lazarus.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above). There is another method ScaleFontsForPPI() which takes care of scaling the font sizes. For older Laz versions, spkToolbars contains his own, simpler, scaling method which is executed in procedure SpkInitLayoutConsts() of unit spkt_Const.

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #7 on: September 24, 2020, 10:16:12 pm »
Thanks for the input, wp. I've read the wiki page, it's clear for me now. I'll try to manage this in my next evolution(s) of SpkToolbar.
« Last Edit: September 25, 2020, 12:04:48 pm by husker »
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #8 on: September 25, 2020, 08:31:53 pm »
Hello all,

Here is a small correction for the spkToolbar editor (design mode) : the bitmap of the action used to insert new SpkRadioButton was not the right one, due to a mistake in the ImageIndex.

Wp (or somebody who know how to do), could you please merge the modified files attached ? I've installed TortoiseSVN, succeeded to do a checkout of spkToolbar from Lazarus-CCR, but I'm not sure what to do to achieve a correct commit... Should I have to create an account on SourceForge to be able to do commit from my Windows Explorer using Tortoise ? How can I tell that it's me the author of the commit ? This is not clear at all for me %)...

Thanks in advance, regards,

Husker.
« Last Edit: September 25, 2020, 09:58:17 pm by husker »
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: spkToolbar evolution
« Reply #9 on: September 25, 2020, 11:42:29 pm »
At the moment you cannot commit. But when you have submitted several changes I can ask that you get commit rights.

Since you have svn now I'd like to ask you to create a proper patch instead of submitting the entire units. A patch contains only differences between your local version and the repository version - this way I can see more easily what you changed.

In order to create a patch with Tortoise you must right-click on your local spktoolbar folder and select "Create patch..." from the "TortoiseSVN" submenu. Tortoise will create a list of changed files, you can double-click any of them to see the changes yourself. Save the patch and upload it here. (This is the same procedure basically how you can create a patch for Lazarus itself).

The ideal place to submit patches is the bug tracker (link in the left forum bar) because changes can be documented in a more formal way than here. But for me, it's ok too if you submit your CCR patches to the forum because CCR is a rather informal activity.

Could you try to practice this with your current modification?
« Last Edit: September 26, 2020, 11:32:03 am by wp »

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #10 on: September 26, 2020, 12:36:27 pm »
At the moment you cannot commit. But when you have submitted several changes I can ask that you get commit rights.

It's OK for me, I don't really want to have direct access to commit. I tested this because I was wondering that maybe it could bother you to merge my changes in the repository for me.

As I said previously, I'm just an hobbyist developer, not a professionnal one, and I prefer that somebody check my changes first before eventually merge then in the repository. I don't want to break things in the repository :). And I have no problem to have comments on my work, as I do this to learn something ;).

Quote from: wp
Since you have svn now I'd like to ask you to create a proper patch instead of submitting the entire units. A patch contains only differences between your local version and the repository version - this way I can see more easily what you changed.

In order to create a patch with Tortoise you must right-click on your local spktoolbar folder and select "Create patch..." from the "TortoiseSVN" submenu. Tortoise will create a list of changed files, you can double-click any of them to see the changes yourself. Save the patch and upload it here. (This is the same procedure basically how you can create a patch for Lazarus itself).

That's OK for me.

Quote from: wp
The ideal place to submit patches is the bug tracker (link in the left forum bar) because changes can be documented in a more formal way than here. But for me, it's ok too if you submit your CCR patches to the forum because CCR is a rather informal activity.

I took a look at bug tracker, maybe I'll use it later, if you think it's necessary. You'll probably have to explain me how it works, however... But for now, I'll create patches and post them here in the forum, for review and merge if all is OK.

Quote from: wp
Could you try to practice this with your current modification?

Attached is the patch for the change in the design editor. Please, check it and tell me if it's OK :).

Thanks for your time and your explanations, they are highly appreciated.

Regards,

Husker.
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: spkToolbar evolution
« Reply #11 on: September 26, 2020, 01:30:43 pm »
Applied your patch, thank you.

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #12 on: September 26, 2020, 09:41:18 pm »
Hello all,

Here is another contribution to spkToolbar.

I've added 'More options' button to Pane. You can now hide/show a button on the right-bottom corner of the pane. When clicked, an event is launched. This way it's possible to show another form, for example.

See screenshots below to see how it looks. Tested with all the built-in styles, but only on Windows 10 1903.

Patch is attached too. Wp, I'm not sure to have handled correctly Hi-Dpi, maybe a double check on this point is necessary.

Enjoy :).

Regards,

Husker
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: spkToolbar evolution
« Reply #13 on: September 26, 2020, 10:32:22 pm »
I took a look at bug tracker, maybe I'll use it later, if you think it's necessary. You'll probably have to explain me how it works, however... But for now, I'll create patches and post them here in the forum, for review and merge if all is OK.

When you want to learn more about how to use bug tracker, you can read this wiki page.

As Werner says, it is ok for now to post your patches for spkToolBar here.
However, as FPC/Lazarus user, one day you will encounter bugs in LCL, or even in the compiler. Then it is nice to report it properly. :)

Understandably, developers will often miss bugs reported in forum. Bugs reported in bugtracker have much bigger chance to be taken and solved. It is also so when asking for improvements.
And further, the chance that the reported bug (or improvement you ask for) gets applied raises a lot when a patch is provided (as you did in this case). But of course, it is not expected that you can solve any bug, then you should just report it.

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #14 on: September 26, 2020, 11:04:48 pm »
Thanks for the link Zoran.

I'll study it and try to post my improvements patches of SpkToolbar directly in Bug Tracker, and put a note on the forum when done.

But what happen if I create a patch if the previous one is not yet applied on the repo ? Wouldn't the second patch also hold the changes of the first patch ? If yes, I guess this will get things confusing in the Bug Tracker %)...
« Last Edit: September 26, 2020, 11:07:45 pm by husker »
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

 

TinyPortal © 2005-2018