Einzelnen Beitrag anzeigen

Benutzerbild von hincapie
hincapie

Registriert seit: 24. Mär 2005
200 Beiträge
 
Delphi 5 Professional
 
#1

Wechsel ItemList in SynCompletionProposal zur Laufzeit?

  Alt 29. Dez 2005, 09:14
Also, ich weise SynCompletionProposal eine Liste mit PHP-Befehlen zu, und aktiviere mit SynEdit.OnChange die Kompletierung (SynCompletionProposal1.ActivateCompletion).
Jetzt möchte ich aber bei der Eingabe des $-Zeichens alle Variablen aus dem SynEdit in die SynCompletionProposal1.ItemList einfügen.

Delphi-Quellcode:
procedure TEditForm.SynEdit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key = Ord('4')) and (Shift = [ssShift]) and (ExtractFileExt(PathName) = '.php') and (code = true) then
  begin
    //code := false;
    ShowMessage('taste $ gedrückt');
    ScanPHPTokens;
    //code := True;
      SynCompletionProposal1.CancelCompletion;
      SynCompletionProposal1.ItemList.Clear;
      SynCompletionProposal1.ItemList.AddStrings(PHPVars);
      SynCompletionProposal1.ResetAssignedList;
      SynCompletionProposal1.ActivateCompletion;
    Key := 0;
  end
end;
Im OnChange von SynEdit1 steht noch folgendes:
  if code then SynCompletionProposal1.ActivateCompletion; wenn ich (code = true) weglasse und code von Hand setze, funktioniert es,
so aber nicht.

Hat schon mal jemand eine solche Funktion in seinem Programm eingebaut?

P.S: ScanPHPTokens sorgt dafür, dass die StringList PHPVars mit allen PHP-Variablen gefüllt wird.
  Mit Zitat antworten Zitat