Forum > SynEdit

Synedit, Synmemo

(1/2) > >>

tatamata:
Have few questions:
1. What is actual difference between TsynEdit and TSynMemo?
2. How can I wrap text in TSynMemo in order not to allow extending text out of the size of control? I don't want to allow the text to spreading  more than actual control size, but rather to continue in next line.
3. How can I add some token to be recognized in a highliter?

Martin_fr:
1) for all good purpose they are identical, and you should use TSynEdit.

TSynMemo has some extra functions, that emulate what a memo does, e.g accessing the cursor pos, as offset in chars from text-strat rather than x/y

2) Neither of them has text wrapping. Been on the todo list for a long time...
You would have to break lines yourself on every resize, not very effective.

3) There are examples  fro the 2 configurable highlighters, in the Lazarus examples/synedit folder
All other info on highlighter can be found here: http://wiki.lazarus.freepascal.org/SynEdit_Highlighter

There is also TSynUniSyn, I haven't ever touched it yet. No idea.

tatamata:
Martin,
I want to use   TSynAutoComplete, but I don't get it...
I have two Dbf tables ("Tables" and "Fields") containing information about tables and fields in my project.
Then I have TSynEdit and TSynSQLSyn highlighter and also TSynAutoComplete.
I populate AutoCompleteList with following code, in order to get list
 of table.field items:


--- Code: ---procedure TFormMain.UpdateAutocompleteList;
var
  vBookmark1:TBookmark;
  vBookmark2:TBookmark;
begin
  vBookmark1:=Tables.GetBookmark;
  vBookmark2:=Fields.GetBookmark;
  try
    Tables.DisableControls;
    Fields.DisableControls;
    Tables.First;
    SynAutoComplete1.AutoCompleteList.Text:='';
    while not Tables.EOF do begin
      Fields.First;
      while not Fields.EOF do begin
        SynAutoComplete1.AutoCompleteList.Append(Tables.FieldByName('TABLENAME').AsString+'.'+Fields.FieldByName('FIELDNAME').AsString);
        Fields.Next;
      end;
      Tables.Next;
    end;
  finally
    Tables.GotoBookmark(vBookmark1);
    Tables.FreeBookmark(vBookmark1);
    Fields.GotoBookmark(vBookmark2);
    Fields.FreeBookmark(vBookmark2);
    Tables.EnableControls;
    Fields.EnableControls;
  end;
end;               
--- End code ---

I hoped it will enable auto-completion when you, for example type "ordrs." that it will be able to see a pop-up list of all possible fields, like "ordrs.ordr, ordrs.cmpnt, etc.".
How to enable autocompletion in this way? What have I missunderstood?
Basically, I want to do what all DBMS usually do - when you type a table identifier and dot, it gives you list of all fields belonging to the table...

Martin_fr:
TSynAutoComplet does not do the popup. TSynComplete (or similar) does.

You need to create it in code, it is not in the component palette.

Again look in the example folder, there is an example featuring both.

tatamata:
Martin, thanks, it works now.
When I enter some leading chars, then press Ctrl+Space, a drop-down list appears with first item that satisfies criteria selected by default.
However, other items matching searching criteria are not at grasp, since all other items are present in list by order in is which they were added to the ItemList...This means that only the first item matching search criteria can be selected, while others are not reachable. because the list is not filtered by search criteria...

So, is there a way to filter the ItemList by search criteria, so that only items matching the pattern are showned?

Navigation

[0] Message Index

[#] Next page

Go to full version