Recent

Author Topic: spkToolbar evolution  (Read 2361 times)

wp

  • Hero Member
  • *****
  • Posts: 7738
Re: spkToolbar evolution
« Reply #15 on: September 27, 2020, 12:41:37 am »
Thanks for the nice patch. I applied it with minor modifications:

- Allow for an "arrow-corner" symbol similar to MS Office, in addition to your "plus" (in case that the font on non-Windows systems does not have the corresponding UTF8 code point).
- Fixed a bug firing mouse click events on a hidden "more options" button.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #16 on: September 27, 2020, 02:29:43 pm »
Thanks wp for corrections and applying the patch :).

I just investigate your changes, and I wonder what is the '#$E2#$87#$B2' code that stands for the arrow char ? When I wrote the code, I wonder how I could draw the arrow but as I don't know how to do it, I wrote instead the '+' sign ::). I didn't know that the arrow could exists as a character or something else. I thought it was drawn like a sort of bitmap.

Good catch on the fire event bug. I neglected to check if the 'more options' button was visible before firing it  :-[...

I've some other ideas for spkToolbar, I'll try to program them.
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 7738
Re: spkToolbar evolution
« Reply #17 on: September 27, 2020, 02:41:15 pm »
I wonder what is the '#$E2#$87#$B2' code that stands for the arrow char ?
Lazarus and thus spktoolbar work with utf8-encoded strings. In order to see all utf8-"characters", open the "Character map" under the "Edit" menu. The "corner arrow" can be found in the "Arrows" range. Note that any arbitrary code point is not necessarily contained in the font currently used. When you click on a cell in the character map the related character is copied into your source code window. The #$E2#$87#$B2 is the binary representation of the "corner arrow" - I hope you know that utf8 consists of up to 4 bytes per "character" (or better: code point - see any other discussion about utf8 here in the forum).
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #18 on: September 27, 2020, 03:23:49 pm »
Thanks for the explanation, wp.

Now, I know what is UTF-8 :D. To be honest, I haven't got theorical programming background. I've learnt by myself, and I've probably missed many important things... "The one who is his own teacher is more likely the student of a dumb", someone told me this one day. OK, I can live with this, as I learn new things every day !

My only programming background is not very useful here: I'm a former G-Code for CNC-driven machines...

But indeed, the built-in character map in Lazarus could be really useful.

I just made a try with a blank project, and tried to assign at runtime this binary representation to a TLabel. But instead of the arrow, I get a "?W" as caption label... And the font label is Segoe UI, so is the TSpkPane font. Do I miss something here %) ?
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 7738
Re: spkToolbar evolution
« Reply #19 on: September 27, 2020, 03:38:21 pm »
No need to excuse for your missing background. I don't have formal IT training either. You submit good patches, and that's all what counts.

I don't know what you are doing exactly. Here is the screenshot for a form with a label, font blown up to 24 pt, and with this OnCreate handler, on Win 10, font Segoe UI:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   Label1.Caption := #$E2#$87#$B2;
  4. end;  
I'm not very happy with this glyph because the arrow head is very tiny at "real" font size -- but maybe you find a better one in the UTF8 table.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #20 on: September 27, 2020, 03:52:33 pm »
I think I've done something wrong... Testing again using  your code is OK, and I get exactly your screenshot. Duuhhh... OK, it works now.
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 7738
Re: spkToolbar evolution
« Reply #21 on: September 27, 2020, 05:04:08 pm »
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 ?
I am not very strong in these version control systems. But my feeling is that with SVN you must wait until the first patch has been applied before you can submit a follow-up patch. With GIT you can create a merge request after each patch separately. Standard access to Lazarus version control, however, is SVN, but I know that some developers maintain a git mirror.

In any case try to keep the patches as "atomic" as possible, i.e. address only a single feature. Do not change formatting or so, because this will crowd the diff file with many unrelated details and make it very difficult to see how the bug is fixed by your changes.

As far as spktoolbar is concerned, I see myself as the current maintainer after the original author disappeared. So, you can assign your spktoolbar bug tracker reports to me, and I will see the report in bugtracker in my personal filtered list. But as i said earlier I do not insist on bug tracker reports, at least for spktoolbar; there is only some chance that I could miss a report when the "Recent" list overflows (in this case - if nothing happens after a few days - send me a PM reminder).
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #22 on: September 27, 2020, 05:38:56 pm »
I had some troubles to update my SpkToolbar after you committed my last patch : updated using SVN cause conflicts on all the changed files. It made my rebuild of Lazarus crashing due to weird texts on the unit (seems that it was the "patch commands" that were put directly in the source :o !). I had to revert back using SVN, and then I got the correct, updated, units... I don't know what happen, but finally all is working now.

If you are OK, I'll continue posting the next patch here for now. And some day, I'll try to use bug tracker...

Next evolution might take a much longer time, I guess theses changes will need to dig deeper ;).
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 7738
Re: spkToolbar evolution
« Reply #23 on: September 27, 2020, 07:15:38 pm »
I had some troubles to update my SpkToolbar after you committed my last patch : updated using SVN cause conflicts on all the changed files. It made my rebuild of Lazarus crashing due to weird texts on the unit (seems that it was the "patch commands" that were put directly in the source :o !). I had to revert back using SVN, and then I got the correct, updated, units... I don't know what happen, but finally all is working now.
The reason probably is that I did not apply your patch byte-by-byte: I renamend some identifiers, and also added the MoreButtonStyle property. Therefore, your version was no longer the same as that from the ccr repository. In such cases, I always revert my version and update to the official revision; in case of a conflict I always accept "their" version.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #24 on: September 27, 2020, 07:19:05 pm »
OK, I understand. I'll do this next time. Thanks for the tip, wp.
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #25 on: September 28, 2020, 10:17:24 pm »
Hello all,

Something is cooking... This is the first step, more to come (soon, I hope !)
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #26 on: October 02, 2020, 11:21:49 am »
Hello all,

Here is my new contribution to TSpkToolbar: I've added a Menu Button that can drop a dropdown menu. This Menu Button can be shown or hidden, as well as a dropdown arrow on it. I tried to choose colors that match the ones already existing on each theme.

Added properties:
  • ShowMenuButton: boolean
  • MenuButtonStyle: allow to change the style between simple caption button or caption button with dropdown arrow
  • MenuButtonCaption: string
  • MenuButtonDropDownMenu: TPopupMenu

Added event:
  • OnMenuButtonClick: this event is fired after the dropdown menu showed by Menu Button click is closed

TSpkAppearance was updated accordingly to manage colors and style of MenuButton: there is now a new "Menu Button" appearance object, exposing colors and style. The design time appearance editor was updated too.

Last, I've modified some demo projects to show the new capacities.

Enjoy :) !

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

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #27 on: October 02, 2020, 11:23:20 am »
Here is the corresponding patch.

Wp or anyone who can do: please review, and if OK merge it in the repository.

Thanks in advance.
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

wp

  • Hero Member
  • *****
  • Posts: 7738
Re: spkToolbar evolution
« Reply #28 on: October 02, 2020, 01:09:47 pm »
To make sure that I understand correctly: Is this the first button of the ribbon which has some special function (I never understood why)? The one that brings up the full-page menu in MS Office and the 2-level drop-down menu of the Win10 Explorer?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

husker

  • New Member
  • *
  • Posts: 20
Re: spkToolbar evolution
« Reply #29 on: October 02, 2020, 01:29:51 pm »
Yes Wp, this is the equivalent of the first blue button of Win10 Explorer or Wordpad.

As I still don't know how to mimic the full page menu of MS Office or the 2-level dropdown menu of some Win10 apps, I've made a simpler one, which mimic the look of the original MS button but dropdown a simple TPopupMenu.

Maybe one day I'll add something closer to the original Ribbon insted of the TPopupMenu...

Please note that it's not mandatory to use this new feature: Menu Button and all related stuff is optional, it's still possible to use TSpkToolbar like previously.

As I was digging deeply in drawing codes, I've also corrected a few drawing glitches that existed on the Tabs, especially visible with Metro Light and Metro Dark themes. The upper right corner of tabs in Active mode had an extra pixel outside the frame, and the left frame line was not drawn at all (the tab rect had its left border outside of the component on the first tab).
Lazarus 2.0.10 / Windows 10 1903 hobbyist developer. Happy to learn every day !

 

TinyPortal © 2005-2018