Recent

Author Topic: BGRA Button Designer App  (Read 24913 times)

digeo

  • Jr. Member
  • **
  • Posts: 54
    • Digeotek
BGRA Button Designer App
« on: December 28, 2011, 10:26:45 pm »
I have recently started with Lazarus after working with Delphi 2007. I have also discovered the BGRA graphics library and liked it a lot.

I have just completed my first app using lazarus and the BGRA library. It is GUI based app to design buttons using BGRA and their button control.

Please try the app (it is virus, malware etc free) and give feedback and suggestions please.

The source is still in the quick and dirty phase and will be available for download shortly.

Due to size limit, program download is available from my website at the following link:

http://www.digeotek.com/bgra-button-designer

So far only available for Win as I am trying to update my Lazarus install on my Linux Mint PC to 0.9.30. BUT, the source should be available soon for download after some clean up.
« Last Edit: December 28, 2011, 10:31:31 pm by digeo »

lainz

  • Guest
Re: BGRA Button Designer App
« Reply #1 on: December 28, 2011, 10:56:31 pm »
When I run the exe the app crash

digeo

  • Jr. Member
  • **
  • Posts: 54
    • Digeotek
Re: BGRA Button Designer App
« Reply #2 on: December 28, 2011, 11:40:30 pm »
Sorry about that. Do not know how that happened. I transfered the exe to the server again and tested download successfully. Probably got corrupted during the upload.

http://www.digeotek.com/bgra-button-designer

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: BGRA Button Designer App
« Reply #3 on: December 29, 2011, 12:48:27 am »
Nice app.

I noticed that the button is not updated when the gradient type is changed (radial, linear etc.)
Conscience is the debugger of the mind

digeo

  • Jr. Member
  • **
  • Posts: 54
    • Digeotek
Re: BGRA Button Designer App
« Reply #4 on: December 29, 2011, 03:34:44 pm »
Everything seems to be working fine on my side. Make sure you are checking the correct state as selected on the ribbon.

There are 3 static buttons, each indicating a state and then there is a 4th button where you can check the normal, hover and clicked states.

I will investigate further to see if I can spot the problem as you mentioned.

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: BGRA Button Designer App
« Reply #5 on: December 29, 2011, 07:59:56 pm »
I understood about the 3 buttons, but this was not the problem. By the way, I suppose you can use csDropDownList for Style property of Comboboxes.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRA Button Designer App
« Reply #6 on: December 29, 2011, 08:49:56 pm »
Your code can be used to add 'LoadFromFile' and 'SaveToFile' in TBGRAButton?

Also if you want we can add the editor in the package.

digeo

  • Jr. Member
  • **
  • Posts: 54
    • Digeotek
Re: BGRA Button Designer App
« Reply #7 on: December 30, 2011, 09:12:28 am »
At the moment I just stream the Test Button component and save all its properties to file. Bad thing is that a binary file is unreadable. SO I am trying to figure out the Lazarus XML support as this will make it much easier to edit the file afterwards with a XML editor.

Save Procedure:
Code: [Select]
procedure TfrmMain.SaveStyle(filename: string);
var
  stream : TFileStream;
begin
  stream := TFileStream.Create(filename, fmCreate);
  stream.WriteComponent(btnTest);
  stream.Free;
end;

Load Procedure:

Code: [Select]
procedure TfrmMain.OpenStyle(filename: string);
var
  strm : TFileStream;
begin
  if FileExists(filename) then
  begin
    strm := TFileStream.Create(filename, fmOpenRead);
    strm.ReadComponent(btnTest);
    strm.Free;
  end; 
end;

lainz

  • Guest
Re: BGRA Button Designer App
« Reply #8 on: December 30, 2011, 03:36:20 pm »
At the moment I just stream the Test Button component and save all its properties to file. Bad thing is that a binary file is unreadable. SO I am trying to figure out the Lazarus XML support as this will make it much easier to edit the file afterwards with a XML editor.

Save Procedure:
Code: [Select]
procedure TfrmMain.SaveStyle(filename: string);
var
  stream : TFileStream;
begin
  stream := TFileStream.Create(filename, fmCreate);
  stream.WriteComponent(btnTest);
  stream.Free;
end;

Load Procedure:

Code: [Select]
procedure TfrmMain.OpenStyle(filename: string);
var
  strm : TFileStream;
begin
  if FileExists(filename) then
  begin
    strm := TFileStream.Create(filename, fmOpenRead);
    strm.ReadComponent(btnTest);
    strm.Free;
  end; 
end;

Wow, nice.

I did some LoadFromFile and SaveToFile with TBGRAImageButton, with INIFiles, but seems that this is the easy way.

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: BGRA Button Designer App
« Reply #9 on: December 30, 2011, 04:37:23 pm »
Lainz, it would be great to have the same text size with or without the canvas option. In fact, I guess it would be good to have the same size as a TLabel component with the same font. Maybe it would be necessary to set the font size in the constructor, because the behavior of unnamed font is strange. What do you think about it ?
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRA Button Designer App
« Reply #10 on: December 30, 2011, 07:30:17 pm »
With canvas option has the same height as TLabel.

Without is the problem, we need to set an internal size when the font.height is zero to scale it to the os default, or set a fixed height in the constructor, but we need to know the value of the height.

This is a crazy thing that I never tested:

In Windows if you change the font height (changing the dpi settings) you are logged out, so there is not any problem on setting the font size on create.

In Ubuntu you can change the font without log out or restart! What happen to the application that is already running?

Of course is a situation that doesn't matter, you're not changing the font height 60 times on an hour =)

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: BGRA Button Designer App
« Reply #11 on: December 30, 2011, 08:11:00 pm »
With canvas option has the same height as TLabel.
I've tried, but here i've got another result : the height is always different from TLabel.

With TLabel and Font Arial of Height -32,
the equivalent is for TBGRAButton without TextCanvas and Font Arial of Height -28
and for TBGRAButton with TextCanvas and Font Arial of Height -36

Quote
Without is the problem, we need to set an internal size when the font.height is zero to scale it to the os default, or set a fixed height in the constructor, but we need to know the value of the height.
That's right. We can do it with ScaleY(...)

Quote
This is a crazy thing that I never tested:

In Windows if you change the font height (changing the dpi settings) you are logged out, so there is not any problem on setting the font size on create.

In Ubuntu you can change the font without log out or restart! What happen to the application that is already running?
I wonder what would happen.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRA Button Designer App
« Reply #12 on: December 30, 2011, 08:42:32 pm »
Code: [Select]
I've tried, but here i've got another result : the height is always different from TLabel.

With TLabel and Font Arial of Height -32,
the equivalent is for TBGRAButton without TextCanvas and Font Arial of Height -28
and for TBGRAButton with TextCanvas and Font Arial of Height -36

Ok. I've tested only 'default' with 0 as font height for both label and canvas, that I've obtained that result.. the height is the same only in that case.

Code: [Select]
That's right. We can do it with ScaleY(...)
you've seen the code of tbgrabutton to see if it works? is that it is filled with the word 'font' everywhere =)

circular

  • Hero Member
  • *****
  • Posts: 4450
    • Personal webpage
Re: BGRA Button Designer App
« Reply #13 on: December 30, 2011, 10:19:54 pm »
Ok.

You sent a PM about using more states for buttons. In fact, I think it would be simplified if the states were dependents. I mean that for example if you change the value for normal state, and that other states have the same value as the normal state, then the other states are also changed. But if you change for example the hover state, it will not change the normal state. See what I mean ? Some states are more logically deduced from other states. This would simplify the whole process of defining a button state, like in CSS.
Conscience is the debugger of the mind

lainz

  • Guest
Re: BGRA Button Designer App
« Reply #14 on: December 31, 2011, 12:22:35 am »
Yes. I think =)

If I change, for example, BodyNormal.Gradient1.StartColor (that now is clRed) with (clLime) and some of the other states has clRed in Gradient1.StartColor, also will be changed. Always I need to change first the BodyNormal and then the other states.

 

TinyPortal © 2005-2018