diff options
author | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-12-22 21:12:27 +0000 |
---|---|---|
committer | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-12-22 21:12:27 +0000 |
commit | 959c1b7acb1b04136ed0d6cdb116a25b3f6aceaa (patch) | |
tree | 9e02c324161717a698ad04a77dabb62a8df4468b /ide | |
parent | 919659a7a575aec89bcbdfbb4dfa3ed895bc74e4 (diff) | |
download | fpc-959c1b7acb1b04136ed0d6cdb116a25b3f6aceaa.tar.gz |
* bug 8004. disable ok button if length(texttosearch)=0 in find dialog
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16615 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'ide')
-rw-r--r-- | ide/weditor.pas | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/ide/weditor.pas b/ide/weditor.pas index 5e54cc2d68..16e1105110 100644 --- a/ide/weditor.pas +++ b/ide/weditor.pas @@ -58,12 +58,12 @@ const cmCollapseFold = 51266; cmExpandFold = 51267; cmDelToEndOfWord = 51268; - + cmInputLineLen = 51269; + EditorTextBufSize = 32768; MaxLineLength = 255; MaxLineCount = 2000000; - CodeTemplateCursorChar = '|'; { char to signal cursor pos in templates } efBackupFiles = $00000001; @@ -708,10 +708,16 @@ type TCodeEditorDialog = function(Dialog: Integer; Info: Pointer): Word; TEditorInputLine = object(TInputLine) - Procedure HandleEvent(var Event : TEvent);virtual; + Procedure HandleEvent(var Event : TEvent);virtual; end; PEditorInputLine = ^TEditorInputLine; + + TSearchHelperDialog = object(TDialog) + OkButton: PButton; + Procedure HandleEvent(var Event : TEvent);virtual; + end; + PSearchHelperDialog = ^TSearchHelperDialog; const { used for ShiftDel and ShiftIns to avoid @@ -6930,15 +6936,36 @@ begin End else Inherited HandleEvent(Event); + s:=getstr(data); + Message(Owner,evBroadCast,cminputlinelen,pointer(length(s))); +end; + +procedure TSearchHelperDialog.HandleEvent(var Event : TEvent); +begin + case Event.What of + evBroadcast : + case Event.Command of + cminputlinelen : begin + if Event.InfoLong=0 then + okbutton^.DisableCommands([cmok]) + else + okbutton^.EnableCommands([cmok]); + clearevent(event); + end; + end; + end; + inherited HandleEvent(Event); end; + function CreateFindDialog: PDialog; var R,R1,R2: TRect; - D: PDialog; + D: PSearchHelperDialog; IL1: PEditorInputLine; Control : PView; CB1: PCheckBoxes; RB1,RB2,RB3: PRadioButtons; + but : PButton; begin R.Assign(0,0,56,15); New(D, Init(R, dialog_find)); @@ -6997,7 +7024,8 @@ begin Insert(New(PLabel, Init(R1, label_find_origin, RB3))); GetExtent(R); R.Grow(-13,-1); R.A.Y:=R.B.Y-2; R.B.X:=R.A.X+10; - Insert(New(PButton, Init(R, btn_OK, cmOK, bfDefault))); + Okbutton:=New(PButton, Init(R, btn_OK, cmOK, bfDefault)); + Insert(OkButton); R.Move(19,0); Insert(New(PButton, Init(R, btn_Cancel, cmCancel, bfNormal))); end; |