Recent

Author Topic: BGRA Controls  (Read 224600 times)

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #90 on: April 20, 2015, 08:01:45 pm »
Nice!

I've added TBCToolBar

Is a TToolBar with OnRedraw event, with BGRABitmap so you can style in your own. Also works withouth themes. Tested only under Windows. It comes with a function to style like in Windows 7 ToolBar (needs to be improved..).


circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRA-Controls
« Reply #91 on: April 20, 2015, 08:09:08 pm »
Looks nice.

On my computer however, the toolbar completely black, nothing appears in it.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #92 on: April 20, 2015, 08:17:08 pm »
Ok, you opened the demo or just placed the component?

I will add a default theme so it does not appear black.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRA-Controls
« Reply #93 on: April 20, 2015, 08:18:54 pm »
I just placed the component in a random app.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #94 on: April 20, 2015, 08:26:27 pm »
Ok, now it should draw a default thing.

The thing is to use the onredraw event, not a list of pre defined themes. But if it is black we need a default one :)

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRA-Controls
« Reply #95 on: April 20, 2015, 08:37:38 pm »
Yes, a default theme is necessary so that people can use the component like that.

I would suggest to add a property to choose among the default themes (including Win7 theme).

And one theme could be "OwnerDraw", that draws nothing, and then have a OnDrawBar event that can be overriden.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #96 on: April 20, 2015, 08:43:16 pm »
The event is already there. OnRedraw And a default drawer is the Windows 7 if you don't use the event.

I don't have any other themes right now, I was using this code in a canvas program with no bgra, but I need to install it here and there and you know, better to get all things in one place to speed up things.. So I converted the canvas drawing to bgrabitmap.

Maybe more defaults can help but right now I dont have others :(

The thing is we can't style the buttons withouth changing a lot of code.. but the trick is combine with TBCButton and it works nicely.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRA-Controls
« Reply #97 on: April 21, 2015, 01:26:10 pm »
That's already very good.  :)

We can add a property to choose the default theme later.

I did some changes:
- when drawing the toolbar, to avoid using Canvas property because switching between Canvas and native BGRABitmap function can be slow.
- add a LimitMemoryUsage property to free the bitmap as soon as possible

That's not related but I also defined an icon for DTThemedClock (in BGRAControls tab)
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #98 on: April 21, 2015, 03:37:50 pm »
Nice. The memory usage thing is nice, perfect for big images, to save memory.

I've added OnRedraw event for FlashProgressBar, for example if we want to display the number of percent advanced, add extra elements or just override all the drawing.


circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRA-Controls
« Reply #99 on: April 21, 2015, 06:52:06 pm »
That's interesting.

Hey I've added a percentage in the test project.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #100 on: April 27, 2015, 07:08:18 pm »
I've added comments on source of BCButton.

Now when you select a property in the object inspector additional information is shown at the bottom. Also when you use a public method / like LoadFromFile / and you hover it in the code editor also information will be shown.

Doing this I found an unused property: property ClickOffset; Any ideas? It was added by Mora when added the stuff that improves dropdown arrow.

Also I found myself into a question: When using LoadFromFile is the same as AssignFromFile? BTW I wrote both methods but I can't remember LOL that's because we never documented nothing  ::)

I think that LoadFromFile stream all the published stuff and assign all, but AssignFromFile assigns only the style related stuff.

Any better comment to replace the current is apreciated.

Code: [Select]
{ Save all published settings to file }
    procedure SaveToFile(AFileName: string);
    { Load and assign all published settings from file }
    procedure LoadFromFile(AFileName: string);
    { Assign the properties from AFileName to this instance }
    procedure AssignFromFile(AFileName: string);

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #101 on: April 28, 2015, 11:06:27 pm »
Hi, I've added c# file for using with BGRABitmapLibrary

This is a test:
Code: [Select]
   
using BGRABitmapLibrary;

            // Create a new bitmap and save to file
            BGRABitmap.bgraCreateWithSize(0,100,100);
            BGRABitmap.bgraSaveToFile(0,"file.png");

            // Create another bitmap
            BGRABitmap.bgraCreate(1);

            // Get Highest ID available
            int id = BGRABitmap.bgraGetHighestID();

            // Display highest ID (1)
            MessageBox.Show(id.ToString());

            // Destroy bitmaps
            BGRABitmap.bgraDestroy(1);
            BGRABitmap.bgraDestroy(0);

            // Create a new bitmap from file
            BGRABitmap.bgraCreateFromFile(0, @"C:\lazarus\images\LazarusSource.bmp");

            // Get bitmap 0 pixel at 19 37 (somewhat brown)
            // Is getting the pixel
            uint pixel = BGRABitmap.bgraGetPixel(0, 19, 37);

            // Is setting the pixel
            BGRABitmap.bgraSetPixel(0, 1, 1, pixel);

            // and saving a modified copy
            BGRABitmap.bgraSaveToFile(0, "file2.png");

            // Destroy bitmap
            BGRABitmap.bgraDestroy(0);
« Last Edit: April 29, 2015, 12:22:52 am by 007 »

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: BGRA-Controls
« Reply #102 on: April 29, 2015, 05:34:41 pm »
Wow that's impressive.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: BGRA-Controls
« Reply #103 on: April 29, 2015, 06:17:13 pm »
Wow that's impressive.

Thanks. I go slowly but its working  :)

Mukatai

  • New Member
  • *
  • Posts: 28
Re: BGRA-Controls
« Reply #104 on: April 30, 2015, 03:02:03 pm »
Hi,

Is it possible to add mousewheel events to BCButton, BCPanel and BCLabel ? (and other button if it's possible)

Thanks for your very good work !

@+

 

TinyPortal © 2005-2018