Recent

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

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: Custom Drawn Controls advances
« Reply #45 on: December 08, 2011, 04:49:37 pm »
Are there plans to add Windows7 theme in Custom Drawn Controls like for Windows XP?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #46 on: December 08, 2011, 04:56:20 pm »
Are there plans to add Windows7 theme in Custom Drawn Controls like for Windows XP?

Not by me, since I don't even have a Windows 7 computer, but the whole idea of the skins is that users should participate in writting them. Patches are welcome =)

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #47 on: December 08, 2011, 09:07:29 pm »
Are there plans to add Windows7 theme in Custom Drawn Controls like for Windows XP?

Well I was working of loading from bitmap here is the code both for TBitmap (native and non native stretch) and TBGRABitmap:

Try this code to read images from bitmap and then use as 'theme' like in Windows.

https://sourceforge.net/p/bmpthemeutils/home/Home/

It has both codes for TBGRABitmap and TBitmap. Currently has no objects only functions and procedures.

Dibo

  • Hero Member
  • *****
  • Posts: 1048
Re: Custom Drawn Controls advances
« Reply #48 on: December 09, 2011, 08:05:53 pm »
How to install Custom Drawn Controls? There is no info on wiki pages. I have latest Lazarus 0.9.31 from SVN, so can I just install Custom Drawn package from Package -> Configure installed packages -> customdrawn 0.0? This is current version?

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #49 on: December 09, 2011, 09:32:50 pm »
How to install Custom Drawn Controls? There is no info on wiki pages. I have latest Lazarus 0.9.31 from SVN, so can I just install Custom Drawn package from Package -> Configure installed packages -> customdrawn 0.0? This is current version?

Yes, then you have the 'Custom Drawn' tab with all the controls. Next you need to create a Drawer and register it

something like this

http://lazarus.freepascal.org/index.php/topic,15209.msg81603.html#msg81603
« Last Edit: December 09, 2011, 09:36:39 pm by lainz »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538

krampits

  • New member
  • *
  • Posts: 8
Re: Custom Drawn Controls advances
« Reply #51 on: December 22, 2011, 05:52:39 pm »
Hi there.

Although i am an old Delphi user, i am completely newbie in Lazarus, so forgive me in advance for my stupid questions.

I would like to make some custom drawn edit controls that are platform free, but without to rewrite all that code concerning the scroll, text selection, cursor etc handling. Could i use the custom drawn controls to do so, and if the answer is yes, then how could i create an edit control that uses a thick frame for example ?

Thank you in advance.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #52 on: December 22, 2011, 06:03:20 pm »
Could i use the custom drawn controls to do so,

Yes, althought TCDEdit is not fully complete yet. It is already functional, however.

Quote
and if the answer is yes, then how could i create an edit control that uses a thick frame for example ?

Create a new drawer class, register it and override any methods that you want.

Read these source code files to know how to do it:

lazarus/components/customdrawn/customdrawn_winxp.pas
lazarus/lcl/customdrawn_common.pas

Your new drawer would be something like customdrawn_winxp.pas which bases on customdrawn_common.pas

krampits

  • New member
  • *
  • Posts: 8
Re: Custom Drawn Controls advances
« Reply #53 on: December 22, 2011, 06:13:15 pm »
felipemdc,

I 've installed the customdrawn.lpk package, but neither the Custom Drawn tab appeared, nor the TCDEdit control. The controls that were installed in Common Controls Tab are, TCDButton, (which creates black marks at corners), TCDTrackBar, TCDPageControl and TCDGroupBox. Unfortunately there are no such files under the directories you 've mentioned. I 've downloaded them from http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/customdrawn, but there is no TCDEdit control in any file.

Thank you once more.  :)

krampits

  • New member
  • *
  • Posts: 8
Re: Custom Drawn Controls advances
« Reply #54 on: December 22, 2011, 06:40:50 pm »
felipemdc,

My bad. I 've found the problem and corrected it. Now the TCDEdit control exists. No customdrawn_common.pas file though. Anyway, I don't understand how could anyone create an edit control that has a 7 px thick frame without covering the text, or how could i create a combobox with 2 or more custom drawn buttons, which responds differently when the mouse is over them. In Delphi, all i had to do was to define the client area of the windowed control and then draw or add other controls outside of it. Could you help me understand please ?

Thank you so much.  :)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #55 on: December 22, 2011, 07:53:02 pm »
No customdrawn_common.pas file though.

For sure it exists, nothing works without it. lazarus/lcl/customdrawn_common.pas in latest lazarus svn

Quote
Anyway, I don't understand how could anyone create an edit control that has a 7 px thick frame without covering the text

The TCDEdit can have any size. If it is covering the text make it bigger.

Quote
In Delphi, all i had to do was to define the client area of the windowed control and then draw or add other controls outside of it. Could you help me understand please ?

You can also add other controls inside your own, although that's not what the drawers are suposed to do. If you need that much customization you might want to write your own control, either basing on the CD ones (by creating a class which inherits from one of them) or not.

krampits

  • New member
  • *
  • Posts: 8
Re: Custom Drawn Controls advances
« Reply #56 on: December 22, 2011, 09:18:16 pm »
felipemdc,

I do make the edit control bigger, but the problem is that although i define border spacing big enough, the text inside the edit does not allocate to the middle of the control, so if i draw a thick frame, or if i place another control inside the edit area, then the text hides behind it. Is there a way to define the client area of the control, in order to make enough space either around the text, or to the right of it, in order to design a thick frame, or to place another control, without using APIs, so the entire edit control to be platform free ? The BorderSpacing property does not seem to work, with or without the Autosize set to true.

I have no problem to write my own control based on the CD ones. That is what i had in mind from the begin.

Thank you so much for your patience.  :)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #57 on: December 22, 2011, 10:02:07 pm »
I do make the edit control bigger, but the problem is that although i define border spacing big enough, the text inside the edit does not allocate to the middle of the control

You can make a bug report about this. A patch would be even better. It should be very easy to fix, just look at the code in customdrawn_controls.pas method DrawEdit or something like that ... but I have a huge ToDo list

Quote
, so if i draw a thick frame, or if i place another control inside the edit area, then the text hides behind it. Is there a way to define the client area of the control, in order to make enough space either around the text, or to the right of it, in order to design a thick frame, or to place another control, without using APIs, so the entire edit control to be platform free ?

Adding extra spacing bellow or on the top is not really desirable, but adding an extra spacing to the right or left is a must have feature which is required for example for TCDComboBox implementation... again you can either bug report or send a patch.

lainz

  • Guest
Re: Custom Drawn Controls advances
« Reply #58 on: December 26, 2011, 03:14:11 am »
I get "no registered drawers were found". I just added a TCDButton in a form.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Custom Drawn Controls advances
« Reply #59 on: December 26, 2011, 12:01:25 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.

 

TinyPortal © 2005-2018