View Issue Details

IDProjectCategoryView StatusLast Update
0004587JEDI VCL03 Donationspublic2008-12-22 04:55
ReporterwessonAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.36 
Summary0004587: JvColorCombo: Make the SampleText accessible
DescriptionWhen SampleText mode is used in TJvColorCombo, the text itself is hardcoded.

Make this text accessible
Additional InformationIncluded patch
TagsNo tags attached.

Activities

2008-11-17 03:26

 

jvColorCombo_access_to_sampletext.patch (2,306 bytes)
Index: JvColorCombo.pas
===================================================================
--- JvColorCombo.pas	(revision 12048)
+++ JvColorCombo.pas	(working copy)
@@ -218,6 +218,7 @@
     FOnDrawPreviewEvent: TJvDrawPreviewEvent;
     FFontSizes:TStrings;
     FEnumeratorDC:HDC;
+    FSampleText: string;
     procedure SetUseImages(Value: Boolean);
     procedure SetDevice(Value: TFontDialogDevice);
     procedure SetOptions(Value: TJvFontComboOptions);
@@ -234,6 +235,8 @@
     procedure SetShowMRU(const Value: Boolean);
     procedure SetMaxMRUCount(const Value: Integer);
     function GetFontSizes: TStrings;
+    procedure SetSampleText(const Value: string);
+    function GetSampleTextStored: Boolean;
   protected
     procedure FontChanged; override;
     procedure Loaded; override;
@@ -314,6 +317,7 @@
     property OnKeyPress;
     property OnKeyUp;
     property OnStartDrag;
+    property SampleText: string read FSampleText write SetSampleText stored GetSampleTextStored;
     property OnDrawPreviewEvent: TJvDrawPreviewEvent read FOnDrawPreviewEvent write FOnDrawPreviewEvent;
   end;
 
@@ -1015,6 +1019,7 @@
   FTrueTypeBmp := LoadInternalBitmap('JvFontComboBoxTTF');
   FFixBmp := LoadInternalBitmap('JvFontComboBoxFIX');
   FDeviceBmp := LoadInternalBitmap('JvFontComboBoxPRN');
+  FSampleText := 'AbCdEfGhIj';
   FHiliteColor := clHighlight;
   FHiliteText := clHighlightText;
   FDevice := fdScreen;
@@ -1206,7 +1211,7 @@
     begin
       Inc(AWidth, TextWidth(Items[Index]) + 36);
       Canvas.Font.Name := Items[Index];
-      S := 'AbCdEfGhIj';
+      S := FSampleText;
       Inc(AWidth, TextWidth(S));
       if DoDrawPreview(Items[Index], S, AWidth) then
       begin
@@ -1338,6 +1343,11 @@
   Reset;
 end;
 
+function TJvFontComboBox.GetSampleTextStored: Boolean;
+begin
+  result := FSampleText <> 'AbCdEfGhIj';
+end;
+
 function TJvFontComboBox.GetSorted: Boolean;
 begin
   Result := inherited Sorted;
@@ -1412,6 +1422,15 @@
   SendMessage(Handle, CB_SETDROPPEDWIDTH, Value, 0);
 end;
 
+procedure TJvFontComboBox.SetSampleText(const Value: string);
+begin
+  if value <> FSampleText then
+  begin
+    FSampleText := value;
+    Invalidate;
+  end;
+end;
+
 procedure TJvFontComboBox.SetShowMRU(const Value: Boolean);
 begin
   if FShowMRU <> Value then

obones

2008-11-18 08:24

administrator   ~0015016

Please provide the zipped sources of a sample application showing this.

2008-11-19 08:47

 

JvFontCombo_sample.zip (4,307 bytes)

2008-11-19 08:51

 

JvFontCombo_sample_withbin.zip (407,725 bytes)

wesson

2008-11-19 08:52

reporter   ~0015034

Oups, my mistake, Description incorrectly refer to TJvColorCombo.

Correct component is TJvFontComboBox (in unit JvColorCombo)

Sample application attached, with binary compiled under D2009

obones

2008-12-22 04:55

administrator   ~0015144

Thanks, this is now fixed in SVN

Issue History

Date Modified Username Field Change
2008-11-17 03:26 wesson New Issue
2008-11-17 03:26 wesson File Added: jvColorCombo_access_to_sampletext.patch
2008-11-18 08:24 obones Note Added: 0015016
2008-11-18 08:24 obones Status new => feedback
2008-11-19 08:47 wesson File Added: JvFontCombo_sample.zip
2008-11-19 08:51 wesson File Added: JvFontCombo_sample_withbin.zip
2008-11-19 08:52 wesson Note Added: 0015034
2008-12-22 04:55 obones Note Added: 0015144
2008-12-22 04:55 obones Status feedback => resolved
2008-12-22 04:55 obones Fixed in Version => Daily / SVN
2008-12-22 04:55 obones Resolution open => fixed
2008-12-22 04:55 obones Assigned To => obones