Recent

Author Topic: Lazarus's missing Delphi features  (Read 22347 times)

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Lazarus's missing Delphi features
« on: January 22, 2016, 03:45:25 am »
I found a few missing feature that Delphi already has, and Lazarus didn't has yet.
It's about to reduce clicks, because that missing delphi features can be reached by more additional clicks on Lazarus.


1. Forwarding keyboards key from form-designer into Object Inspector.
    (done in 24jan16, rev 51398 issue #29488)
    in delphi, when a form-designer is activated, you can just typing  by keyboard,
    and those keys-pressed will be written to Object Inspector.
    So no need to activate OI to edit property.


2. Double click on any linked-object combobox on Object Inspector will switch the value into next item.
   (done 26jan 2016 issue #0029503)
    I can't do this in Lazarus. What I can do is click dropdown to show the list, read whether the value is on
    there, and click in correct line/value of that dropdownlist.

    Correction: For combobox with property's type of enumeration, boolean or set, it works.
    Only for linked item it doesn't work. For example: "Images" and "HotImages" property of TToolbar.

3. Code explorer doesn't helps enough to jump to procedure implementation.
    There should available in lazarus: an easy way rather than clicks several time, by such adding
     new keystroke: Ctrl+Click / Atl+Shift+Click(?) to jump to method implementation,
     instead of only can jump to interface/declaration.


4.  Object Inspector should able to remember the last selected property (for next selected control).
     OI should select "Text" property in the end of any below activities:
     a) Drop a TEdit in form, change the Text property, drop a TButton, select again the TEdit
     b) Drop a TEdit in form, change the Text property, drop a TEdit (done thanks GetMem)
     (lazarus: none property is selected, it should be "Text" property is selected.)


Well, okay, 4 time click is done in 4 seconds. But repeating that will distracts user (me).
IMHO it would be better if we can reduce known obstacle to increase productivity.


I am ready to implement above features, if I have a clue to do.
Thanks!
« Last Edit: February 02, 2016, 04:05:05 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #1 on: January 22, 2016, 10:37:40 am »
Help!
How to send a key (keyboard / char) to other form in Lazarus?
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Lazarus's missing Delphi features
« Reply #2 on: January 22, 2016, 03:31:01 pm »
You need the LazMouseAndKeyInput package (which is included in the standard Lazarus installation).
There is an example of usage at
lazarus/components/mouseandkeyinput/example
which types "hello" into an edit control (as well as demonstrating programmed mouse movement and selection).

balazsszekely

  • Guest
Re: Lazarus's missing Delphi features
« Reply #3 on: January 22, 2016, 05:04:37 pm »
@x2nie

3. As a temporary solution, you should record a key combination with the macro recorder:  http://forum.lazarus.freepascal.org/index.php/topic,30790.msg196255.html#msg196255
2. It's working at my side, at least partially(Win7/Laz trunk/FPC 3.0.0). Sometimes I can change the values sometimes not.
1. This one is interesting, indeed a missing feature. As I saw your post, I felt an overwhelming desire to implement it.  So here it is(attachment):
You can find two files(designer.pp and main.pp). Please copy to $(LazarusDir)/Designer and  $(LazarusDir)/IDE, replace the original ones(or if you like apply the DesignerToObjectInspector.patch), then rebuild Lazarus. Please note, this will work with the current SVN version(r51377) and perhaps with the next few ones.

PS: If needed I can create a more polished version and add it to the bug tracker.

balazsszekely

  • Guest
Re: Lazarus's missing Delphi features
« Reply #4 on: January 24, 2016, 04:04:26 pm »
@x2nie

In the meantime 1. is already implemented in the trunk(r. 51398). @Ondrej was kind enough to commit it + helped with a few good ideas.

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #5 on: January 25, 2016, 03:45:27 am »
Thanks you dear all! My Lazarus Trunk is little bit more sexy, and it make the work with designer easier now.


I marked the point (1) as solved.


and I added the point (4)., today.
Without solving the point (4), the point (1) is useless.


IMHO it is our behavior: changing similar (one) property of each controls in whole  form.
So, in this case we don't want to change the selected property into other prop when we are selecting other control.
For sample, Let say we are in changing the "TabOrder" property,
So we select the first control, activating Object Inspector and changing the value of TabOrder of selected control with "0" value.
Next, we select the second control, pressing "1" to changing the TabOrder property of second control.
Next, we select the third control, and (without activate OI) pressing "2" to set TabOrder property of 3rd.
Next, .....


But, when OI (of Lazarus) still can't remember the selected property, we can NOT do this. >:D
« Last Edit: January 25, 2016, 04:05:21 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #6 on: January 25, 2016, 06:44:40 am »
2. It's working at my side, at least partially(Win7/Laz trunk/FPC 3.0.0). Sometimes I can change the values sometimes not.
Wow! yes. I've double checked, and it also working, not for all cases.
The OI combobox's value changed circularly, if the property type is in [enum, boolean, set].
(Boolean is now drawn as checkbox, not combobox).
Meaning: if that combobox is not that types, it can't circular the value by double-click.
Code: Pascal  [Select][+][-]
  1. procedure TOICustomPropertyGrid.ToggleRow;
  2. var
  3.   CurRow: TOIPropertyGridRow;
  4.   TypeKind : TTypeKind;
  5. begin
  6.   if not CanEditRowValue(false) then exit;
  7.  
  8.  
  9.   if FHintTimer <> nil then
  10.     FHintTimer.Enabled := False;
  11.  
  12.  
  13.   if (FCurrentEdit = ValueComboBox) then
  14.   begin
  15.     //either an Event or an enumeration or Boolean
  16.     CurRow := Rows[FItemIndex];
  17.     TypeKind := CurRow.Editor.GetPropType^.Kind;
  18.     if TypeKind in [tkEnumeration, tkBool, tkSet] then //<------ limited type
  19.     begin
  20.       // set value to next value in list
  21.       if ValueComboBox.Items.Count = 0 then Exit;
  22.       if ValueComboBox.ItemIndex < (ValueComboBox.Items.Count - 1) then
  23.         ValueComboBox.ItemIndex := ValueComboBox.ItemIndex + 1
  24.       else
  25.         ValueComboBox.ItemIndex := 0;
  26.       SetRowValue(false);
  27.       exit;
  28.     end;
  29.   end;
  30.   DoCallEdit;
  31. end;    

Possible another type (that can't be double-clicked yet) are "linked object", and "Event".
Sample: "Image" property of TToolbar.




Quote
PS: If needed I can create a more polished version and add it to the bug tracker.
Sure, please do that. And let us know the issue number here.
« Last Edit: January 25, 2016, 07:08:10 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

balazsszekely

  • Guest
Re: Lazarus's missing Delphi features
« Reply #7 on: January 25, 2016, 06:55:59 am »
@x2nie
Quote
Wow! yes. I've double checked, and it also working, not for all cases.
I guess you can consider 2 solved too, or if you like you can extend the typekind, just make sure it doesn't introduce regression.

I'm working now on 4, it will be ready today. 3 is more difficult, it turned out that it was requested many time in the past. I'm planning to solve that too, but it will take time.

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #8 on: January 25, 2016, 07:05:13 am »
@x2nie
Quote
Wow! yes. I've double checked, and it also working, not for all cases.
I guess you can consider 2 solved too,
No it isn't solved yet. I only show the original code. But I am trying the point (2). 8)


Quote
or if you like you can extend the typekind, just make sure it doesn't introduce regression.
Excuse me, what is "regression"? is that related to cross platform issue?
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

balazsszekely

  • Guest
Re: Lazarus's missing Delphi features
« Reply #9 on: January 25, 2016, 07:16:19 am »
Quote
Excuse me, what is "regression"? is that related to cross platform issue?
I mean when you solve an existing bug or extend a feature, but in the same time you introduce another bug. Since lazarus is a complex project, it happens very often.

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #10 on: January 25, 2016, 08:59:43 am »
@GetMem, I solved number 2.
Below is modified codes of that proc. Would you like to create patch of it?
I've reported this as issue #0029503

AFAIK it wouldn't be a regression, because everything (combobox items) are already exists there.


Code: Pascal  [Select][+][-]
  1. //object Inspector.pp
  2.  
  3. procedure TOICustomPropertyGrid.ToggleRow;
  4. var
  5.   CurRow: TOIPropertyGridRow;
  6.   TypeKind : TTypeKind;
  7. begin
  8.   if not CanEditRowValue(false) then exit;
  9.  
  10.  
  11.   if FHintTimer <> nil then
  12.     FHintTimer.Enabled := False;
  13.  
  14.  
  15.   if (FCurrentEdit = ValueComboBox) then
  16.   begin
  17.     //either an Persistent or an enumeration or Boolean
  18.     CurRow := Rows[FItemIndex];
  19.     TypeKind := CurRow.Editor.GetPropType^.Kind;
  20.     if TypeKind in [tkEnumeration, tkBool, tkSet] then
  21.     begin
  22.       if ValueComboBox.Items.Count = 0 then Exit;
  23.       // set value to next value in list
  24.       if ValueComboBox.ItemIndex < (ValueComboBox.Items.Count - 1) then
  25.         ValueComboBox.ItemIndex := ValueComboBox.ItemIndex + 1
  26.       else
  27.         ValueComboBox.ItemIndex := 0;
  28.       SetRowValue(false);
  29.       exit;
  30.     end
  31.     else if TypeKind <> tkMethod then  {dblClick Event shall jump/create Method in editor}
  32.     begin
  33.       //ShowMessage('ItemCount='+inttostr(ValueComboBox.Items.Count));
  34.       if ValueComboBox.Items.Count <= 1 then //oiNone only. meaning empty
  35.          Exit;
  36.  
  37.  
  38.       // set value to next value in list
  39.       if ValueComboBox.ItemIndex <= 0 then //oiNone or ''(-1).
  40.         ValueComboBox.ItemIndex := 1 // jump to the first real persistent
  41.       else if ValueComboBox.ItemIndex < (ValueComboBox.Items.Count - 1) then
  42.          ValueComboBox.ItemIndex := ValueComboBox.ItemIndex + 1
  43.       else
  44.         ValueComboBox.ItemIndex := 0;
  45.       SetRowValue(false);
  46.       exit;
  47.  
  48.  
  49.     end;
  50.   end;
  51.   DoCallEdit;
  52. end;      


As far, I found there are 3 kinds that OI combobox is working with:
- ordinal types (set, enumeration, boolean)
- method / events.
- persistent.


I exclude events from cycling it's value, because the default behavior of double-click event is: create method in window editor (or jump to method if already there).


So, my additional code is for deal with persistent.
« Last Edit: January 25, 2016, 10:52:03 am by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

balazsszekely

  • Guest
Re: Lazarus's missing Delphi features
« Reply #11 on: January 25, 2016, 12:58:03 pm »
Quote
I've reported this as issue #0029503
You should create a patch, if you're under windows, just download Tortoise SVN, then click Create Patch on the menu, after you finish editing the source. It's much easier for developer to apply the patch.

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #12 on: January 25, 2016, 01:06:26 pm »
Well,
@GetMem, can you do that (patch) for me? I just dislike making them.
I don't know... I just... a little allergic  ;D :P [size=78%] [/size]
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

balazsszekely

  • Guest
Re: Lazarus's missing Delphi features
« Reply #13 on: January 25, 2016, 01:16:43 pm »
@x2nie
Yes, sure! Just tell me which line has changed exactly.

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Lazarus's missing Delphi features
« Reply #14 on: January 25, 2016, 01:21:23 pm »
@x2nie
Yes, sure! Just tell me which line has changed exactly.
Above procedure.
(I posted 2 procs. first is original, second is modified)
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

 

TinyPortal © 2005-2018