View Issue Details

IDProjectCategoryView StatusLast Update
0033410LazarusIDEpublic2018-03-18 01:23
ReportersilvioprogAssigned Towp 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.9 (SVN)Product Build 
Target Version1.10Fixed in Version1.9 (SVN) 
Summary0033410: [Patch][IDEIntf] Register a property editor for TFileName properties
DescriptionHello.

Patch in attachment.
Steps To ReproduceApply the patch, rebuild the IDE and now you can use an open dialog to select the file from any component that has a TFileName property (e.g: BufDataset).
TagsNo tags attached.
Fixed in Revision57498
LazTarget-
Widgetset
Attached Files
  • 0001-IDEIntf-Registers-a-generic-PropertyEditor-for-the-p.patch (1,185 bytes)
    From fafd281ca5a8d4a5ea66f9242355624f5ffacc9c Mon Sep 17 00:00:00 2001
    From: silvioprog <silvioprog@gmail.com>
    Date: Sun, 11 Mar 2018 02:11:13 -0300
    Subject: [PATCH 1/1] IDEIntf: Register a property editor for TFileName properties. (patch by silvioprog)
    
    ---
     components/ideintf/propedits.pp | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/components/ideintf/propedits.pp b/components/ideintf/propedits.pp
    index 8659ce1..e7253b2 100644
    --- a/components/ideintf/propedits.pp
    +++ b/components/ideintf/propedits.pp
    @@ -7939,6 +7939,7 @@ begin
       RegisterPropertyEditor(TypeInfo(TTabOrder), TControl, 'TabOrder', TTabOrderPropertyEditor);
       RegisterPropertyEditor(TypeInfo(ShortString), nil, '', TCaptionPropertyEditor);
       RegisterPropertyEditor(TypeInfo(TStrings), nil, '', TStringsPropertyEditor);
    +  RegisterPropertyEditor(TypeInfo(TFileName), nil, '', TFileNamePropertyEditor);
       RegisterPropertyEditor(TypeInfo(AnsiString), nil, 'SessionProperties', TSessionPropertiesPropertyEditor);
       RegisterPropertyEditor(TypeInfo(TModalResult), nil, 'ModalResult', TModalResultPropertyEditor);
       RegisterPropertyEditor(TypeInfo(TShortCut), nil, '', TShortCutPropertyEditor);
    -- 
    2.7.4
    
    

Relationships

related to 0033441 closedMichael Van Canneyt FPC [patch] declares TFileName as type of string 

Activities

silvioprog

2018-03-11 06:33

reporter  

0001-IDEIntf-Registers-a-generic-PropertyEditor-for-the-p.patch (1,185 bytes)
From fafd281ca5a8d4a5ea66f9242355624f5ffacc9c Mon Sep 17 00:00:00 2001
From: silvioprog <silvioprog@gmail.com>
Date: Sun, 11 Mar 2018 02:11:13 -0300
Subject: [PATCH 1/1] IDEIntf: Register a property editor for TFileName properties. (patch by silvioprog)

---
 components/ideintf/propedits.pp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/components/ideintf/propedits.pp b/components/ideintf/propedits.pp
index 8659ce1..e7253b2 100644
--- a/components/ideintf/propedits.pp
+++ b/components/ideintf/propedits.pp
@@ -7939,6 +7939,7 @@ begin
   RegisterPropertyEditor(TypeInfo(TTabOrder), TControl, 'TabOrder', TTabOrderPropertyEditor);
   RegisterPropertyEditor(TypeInfo(ShortString), nil, '', TCaptionPropertyEditor);
   RegisterPropertyEditor(TypeInfo(TStrings), nil, '', TStringsPropertyEditor);
+  RegisterPropertyEditor(TypeInfo(TFileName), nil, '', TFileNamePropertyEditor);
   RegisterPropertyEditor(TypeInfo(AnsiString), nil, 'SessionProperties', TSessionPropertiesPropertyEditor);
   RegisterPropertyEditor(TypeInfo(TModalResult), nil, 'ModalResult', TModalResultPropertyEditor);
   RegisterPropertyEditor(TypeInfo(TShortCut), nil, '', TShortCutPropertyEditor);
-- 
2.7.4

Michl

2018-03-11 11:02

developer   ~0107062

Applied. Thank you!

silvioprog

2018-03-11 19:12

reporter   ~0107065

Thank you dude!

wp

2018-03-15 17:51

developer   ~0107138

Last edited: 2018-03-15 17:52

View 2 revisions

This patch breaks the property editor of properties declared as "string", I guess because "TFileName = string", not "TFileName = type string".

Add a TBufDataset to the form, select the property "IndexName" --> there is the [...] button, and this opens a FileDialog! Note that "IndexName" is declared as "string".

On the other hand, add a TEdit. Select the property "Text" --> no [...]. This property is declared as TCaption which is the same as TTranslateText, and this is declared as "type string" and thus is not affected by the new property editor.

Removing the patch gets back the normal behavior

Juha Manninen

2018-03-15 18:18

developer   ~0107140

A patch for FPC should be offered to make it "TFileName = type string".
After it gets applied the property editor in Lazarus code can be put inside an IFDEF.

silvioprog

2018-03-16 19:28

reporter   ~0107161

@wp: Thanks for reporting! (y)
@Juha: Fully agreed. I'm going to do that and back to show the link! :-)

silvioprog

2018-03-16 19:37

reporter   ~0107163

Done: https://bugs.freepascal.org/view.php?id=33441 .

silvioprog

2018-03-16 19:46

reporter   ~0107165

The new attached patch "0001-IDEIntf-adds-IFDEF-in-TFileName-PropertyEditor-as-su.patch" should fix the problem issued by @wp if the FPC's 0033441 could apply the patch "0001-rtl-sysutils-declares-TFileName-as-type-of-string-pl.patch".

wp

2018-03-16 20:05

developer   ~0107166

Am I seeing this correctly that the new patch (for the issue of the present report) just adds the registration line? Then it is not correct because it will still break the string property editors for those users who have an fpc older than v3.1.1.

You must add an IF:

{IF FPC_FULLVERSION >= 3010100}
  --- (your line)
{$ENDIF}

BTW, did you test the FPC patch together with your patch here? I tried the same for some time today and ran into this problem:

- Add a TBufDataset to the form.
- Add an IndexDef
- Go back to the TBufDataset. Click into its "FileName" property --> Lazarus hangs or crashes.

However, I am currently having issues with my fpc trunk installation. So I am not sure if this is a correct observation, or due to my broken installation.

silvioprog

2018-03-16 20:50

reporter   ~0107171

You are right. I would like to do something like "{IF FPC_FULLVERSION >= SOME-SPECIFIC-NUMBER-RELATED-TO-THE-ISSUE-0033441}" (sorry the long word, it is just to demonstrate the situation), but I'm not sure if it is possible to do that. :-/

Juha Manninen

2018-03-16 21:08

developer   ~0107172

Silvio Cl├ęcio, testing for FPC 3.1.1 is enough once the change is there. Only the latest FPC trunk revision is supported in such cases.

silvioprog

2018-03-16 21:12

reporter   ~0107173

Awesome! :-)

wp

2018-03-17 16:50

developer   ~0107201

Now that TFileName is declared as "type string" I added an {$IF FPC_FullVersion >= 30101} around the registration of the TFileName propery editor.

Note, however, that most FileName properties in the LCL are declared as "string", not as "TFileName", and thus the new property editor is not used. Patches for affected components are welcome.

Please close if ok.

silvioprog

2018-03-18 01:23

reporter   ~0107226

Thanks dudes!

Issue History

Date Modified Username Field Change
2018-03-11 06:33 silvioprog New Issue
2018-03-11 06:33 silvioprog File Added: 0001-IDEIntf-Registers-a-generic-PropertyEditor-for-the-p.patch
2018-03-11 10:58 Michl Assigned To => Michl
2018-03-11 10:58 Michl Status new => assigned
2018-03-11 11:02 Michl Fixed in Revision => 57498
2018-03-11 11:02 Michl LazTarget => -
2018-03-11 11:02 Michl Note Added: 0107062
2018-03-11 11:02 Michl Status assigned => resolved
2018-03-11 11:02 Michl Fixed in Version => 1.9 (SVN)
2018-03-11 11:02 Michl Resolution open => fixed
2018-03-11 11:02 Michl Target Version => 1.10
2018-03-11 19:12 silvioprog Note Added: 0107065
2018-03-11 19:12 silvioprog Status resolved => closed
2018-03-15 17:51 wp Note Added: 0107138
2018-03-15 17:51 wp Status closed => assigned
2018-03-15 17:51 wp Resolution fixed => reopened
2018-03-15 17:52 wp Note Edited: 0107138 View Revisions
2018-03-15 18:18 Juha Manninen Note Added: 0107140
2018-03-16 19:28 silvioprog Note Added: 0107161
2018-03-16 19:37 silvioprog Note Added: 0107163
2018-03-16 19:46 silvioprog Note Added: 0107165
2018-03-16 20:05 wp Note Added: 0107166
2018-03-16 20:50 silvioprog Note Added: 0107171
2018-03-16 21:08 Juha Manninen Note Added: 0107172
2018-03-16 21:12 silvioprog Note Added: 0107173
2018-03-16 23:11 Bart Broersma Relationship added related to 0033441
2018-03-17 16:50 wp Note Added: 0107201
2018-03-17 16:50 wp Status assigned => resolved
2018-03-17 16:50 wp Resolution reopened => fixed
2018-03-17 16:50 wp Assigned To Michl => wp
2018-03-18 01:23 silvioprog Note Added: 0107226
2018-03-18 01:23 silvioprog Status resolved => closed