Recent

Author Topic: Custom Drawn Controls advances  (Read 151537 times)

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #60 on: December 26, 2011, 04:26:46 pm »
I get "no registered drawers were found". I just added a TCDButton in a form.

At design time or at runtime?

Try adding customdrawn_common to your uses clause.

At runtime. That solved the problem, thanks.

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #61 on: December 26, 2011, 11:41:45 pm »
I've updated bitmapthemeutils v0.0.0.3, now you can test the windows 7 button in a TCDButton with the customdrawn_win7. It's using TBitmap, but you can change it to use TBGRABitmap, just change

Code: [Select]
win7button: TBitmapThemeUtil;to
Code: [Select]
win7button: TBGRABitmapThemeUtil;when needed.

If you want other style just change the bitmap file =)

Grab it here:
https://sourceforge.net/projects/bmpthemeutils/

PD: Seems that the drawer has flickering with themes disabled in Windows. There is a memory leak somewhere but I can't find it. Is left to implement the glowing effect that is present when you enable the effects in Windows..

PD2: How I can draw the Enabled := False state?
« Last Edit: December 26, 2011, 11:45:04 pm by lainz »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #62 on: December 27, 2011, 12:12:13 am »
PD2: How I can draw the Enabled := False state?

In the Drawer class in the drawbutton routine you get two parameters: State and StateEx.

To check if the control is enabled do:

if csfEnabled in AState then ...
else ....

Check all posible enum State information in customdrawndrawers.pas type TCDControlStateFlag

Advanced state information goes into StateEx which is different for various controls.

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #63 on: December 27, 2011, 04:09:11 am »
Thankyou! it's working now.

The only problem in the CDControls is the flickering when you use it with themes disabled under Windows.
« Last Edit: December 27, 2011, 04:12:54 am by lainz »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #64 on: December 27, 2011, 10:24:51 am »
The only problem in the CDControls is the flickering when you use it with themes disabled under Windows.

All of them flicker or only using your drawer?

This is very strange, because in customdrawncontrols.pas there is:

{$if defined(LCLWin32)}
  {$define CDControlsDoDoubleBuffer}
{$endif}

Maybe I got the define wrong somehow?

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #65 on: December 27, 2011, 05:22:17 pm »
All of them.

Can be the define because when I use

Code: [Select]
  CDButton1.DoubleBuffered:= True;
  CDEdit1.DoubleBuffered := True;   

The flickering dissapear.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #66 on: December 27, 2011, 06:45:59 pm »
Is it fixed in rev 34449 ?

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #67 on: December 27, 2011, 10:41:31 pm »
Is it fixed in rev 34449 ?

Doesn't works. The controls starts with DoubleBuffered set to false.

This works:
Code: [Select]
{$IFDEF WINDOWS}
  {$define CDControlsDoDoubleBuffer}
{$endif}     

Another thing, in the controls TCDCheckbox and TCDRadioButton in AState csfSunken is always present, I want this only when the mouse is down, like in TCDButton.

Also I have a problem in the Object Inspector selecting the property State in TCDCheckbox. I select one and other is selected.

Another thing is when is enabled AllowGrayed the states are wrong drawed (see image attached, the red rectangle). Are ok when AllowGrayed is set to false (the other CheckBoxes).

You can grab all the code here https://sourceforge.net/projects/bmpthemeutils/ in the git repo.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #68 on: December 27, 2011, 11:58:08 pm »
Doesn't works. The controls starts with DoubleBuffered set to false.

This works:
Code: [Select]
{$IFDEF WINDOWS}
  {$define CDControlsDoDoubleBuffer}
{$endif}     

Thanks, hopefully fixed now in rev 34452

Quote
Another thing, in the controls TCDCheckbox and TCDRadioButton in AState csfSunken is always present, I want this only when the mouse is down, like in TCDButton.

Also I have a problem in the Object Inspector selecting the property State in TCDCheckbox. I select one and other is selected.

Another thing is when is enabled AllowGrayed the states are wrong drawed (see image attached, the red rectangle). Are ok when AllowGrayed is set to false (the other CheckBoxes).

I would recommend sending patches. All issues look easy to fix, but I have 1 zillion things to do... or you can create bug reports and I'll put somewhere in my ToDo.

krampits

  • New member
  • *
  • Posts: 8
Re: Custom Drawn Controls advances
« Reply #69 on: December 28, 2011, 12:07:54 am »
TCDEdit has some issues on drawing the selected text...

 :)

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #70 on: December 28, 2011, 04:11:14 am »
Code: [Select]
Thanks, hopefully fixed now in rev 34452
It's working.

Code: [Select]
I would recommend sending patches. All issues look easy to fix, but I have 1 zillion things to do... or you can create bug reports and I'll put somewhere in my ToDo.
Ok I will try to fix them.

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #71 on: December 28, 2011, 06:29:19 pm »
I know that I should solve as many problems sending a patch, but I prefer doing it this way to not make mistakes.

This is the patch to fix this:
Code: [Select]
in the controls TCDCheckbox and TCDRadioButton in AState csfSunken is always present, I want this only when the mouse is down, like in TCDButton.
PD: why we can't upload .patch files in the forum?
« Last Edit: December 28, 2011, 06:51:22 pm by lainz »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #72 on: December 28, 2011, 06:49:13 pm »
PD: why we can't upload .patch files in the forum?

It has a white list to check for allowed extensions ... probably a black list would be better if all we want is blocking .exe

Please try again, I added .diff and .patch to the allowed extensions

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #73 on: December 28, 2011, 06:59:20 pm »
It's working now we can upload .patch

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #74 on: December 28, 2011, 07:21:25 pm »
Try rev 34475, I did a slightly different approach for the fix.

 

TinyPortal © 2005-2018