View Issue Details

IDProjectCategoryView StatusLast Update
0002370JEDI VCL00 JVCL Componentspublic2004-12-16 06:37
ReporteranonymousAssigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 BETA 
Target VersionFixed in Version3.00 RC 1 
Summary0002370: TJvBitBtn and TJvImgBtn missing Flat property
DescriptionIt would be very nice if both TJvBitBtn and TJvImgBtn would have Flat property. What I actually need is something like TJvArrowButton but wiht ability to take keybord focus (ie TWinControl descendant. perhaps this should be filed as separate feature request?)...
It also looks like TJvImgBtn.Alignment doesn't work?
TagsNo tags attached.

Activities

user72

2004-12-11 05:06

  ~0005862

You can use the OwnerDraw/OnButtonDraw property/event of TJvImageBtn to make the button look any way you like. Here's an example on how to draw a button in the standard style:

procedure TForm1.JvImgBtn2ButtonDraw(Sender: TObject;
  const DrawItemStruct: tagDRAWITEMSTRUCT);
var Flags:Cardinal;R:TRect;
begin
  Flags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
  if DrawItemStruct.itemState and ODS_SELECTED <> 0 then
    Flags := Flags or DFCS_PUSHED
  R := JvImgBtn2.ClientRect;
  DrawFrameControl(DrawItemStruct.hDC, R, DFC_BUTTON, Flags);
  if DrawItemStruct.itemState and ODS_SELECTED <> 0 then
    OffsetRect(R, 1, 1);
  DrawText(DrawItemStruct.hDC, PChar(JvImgBtn2.Caption), -1, R, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
end;


> It also looks like TJvImgBtn.Alignment doesn't work?
Works for me. Please provide more info.

2004-12-11 05:55

 

JvCtrls041211.zip (12,172 bytes)

user72

2004-12-11 05:57

  ~0005864

Last edited: 2004-12-11 05:58

Try the attached files. Also added a DropArrow property to control whether assigning a DropDownMenu displays an arrow in the button. Only JvImgBtn has been changed (changing JvBitBtn is to much work).

anonymous

2004-12-15 10:04

viewer   ~0005887

peter - very cool! JvImgBtn now looks as I want. Yes it's true that I could have use OwnerDraw for this but flat look is so common that IMO it makes sense to implement it in the control so that everyone don't have to hand-code it.

>> It also looks like TJvImgBtn.Alignment doesn't work?
>Works for me. Please provide more info.

Now works for me too. Was probably bug in old version...

user72

2004-12-15 11:02

  ~0005889

Don't worry: I'll commit the changes. I just wanted some feedback on the implementation so it was what you expected :)

user72

2004-12-16 06:37

  ~0005898

Comitted to CVS

Issue History

Date Modified Username Field Change
2004-12-10 07:21 anonymous New Issue
2004-12-11 05:06 user72 Note Added: 0005862
2004-12-11 05:06 user72 Status new => feedback
2004-12-11 05:55 user72 File Added: JvCtrls041211.zip
2004-12-11 05:57 user72 Note Added: 0005864
2004-12-11 05:58 user72 Note Edited: 0005864
2004-12-15 10:04 anonymous Note Added: 0005887
2004-12-15 11:02 user72 Note Added: 0005889
2004-12-16 06:37 user72 Status feedback => resolved
2004-12-16 06:37 user72 Resolution open => fixed
2004-12-16 06:37 user72 Assigned To => user72
2004-12-16 06:37 user72 Note Added: 0005898
2004-12-16 06:37 user72 Assigned To user72 =>