Posted: Fri Apr 04, 2003 3:55 pm
Restored from previous forum. Originally posted by Jose.
Hi All,
I allways wanted to be able to search for the word under the cursor or selected text automatically, I just sometimes want to do quick search for the word under the cursor, instead of having to first select it and copy, then paste it into the find box;
This small code change to the FindWindow.pb file does just this.
The code looked like this;
Procedure OpenFindWindow(State)
If OpenWindow(#WINDOW_Find, 0, 0, #WINDOW_Find_Width, #WINDOW_Find_Height, #PB_Window_SystemMenu | #PB_Window_WindowCentered | #PB_Window_Invisible, Langage(72))
I change it to look like this, to help lazy people like me.
Procedure OpenFindWindow(State)
Protected CurrentWord.s ;-Add This
CurrentWord = GetCurrentWord() ;-Add This
If Len(CurrentWord) > 1 ;-Add This
GlobalFindText$ = CurrentWord ;-Add This
EndIf ;-Add This
If OpenWindow(#WINDOW_Find, 0, 0, #WINDOW_Find_Width, #WINDOW_Find_Height, #PB_Window_SystemMenu | #PB_Window_WindowCentered | #PB_Window_Invisible, Langage(72))
This little trick makes it easy to search for the word under the cursor, as it gets inserted into the find automatically.
@Fred and Danilo
Thanks for a great editor, maybe you could improve on this or add it to the editor for future, this is how many other editors I have used work.
Thanks
Hi All,
I allways wanted to be able to search for the word under the cursor or selected text automatically, I just sometimes want to do quick search for the word under the cursor, instead of having to first select it and copy, then paste it into the find box;
This small code change to the FindWindow.pb file does just this.
The code looked like this;
Procedure OpenFindWindow(State)
If OpenWindow(#WINDOW_Find, 0, 0, #WINDOW_Find_Width, #WINDOW_Find_Height, #PB_Window_SystemMenu | #PB_Window_WindowCentered | #PB_Window_Invisible, Langage(72))
I change it to look like this, to help lazy people like me.
Procedure OpenFindWindow(State)
Protected CurrentWord.s ;-Add This
CurrentWord = GetCurrentWord() ;-Add This
If Len(CurrentWord) > 1 ;-Add This
GlobalFindText$ = CurrentWord ;-Add This
EndIf ;-Add This
If OpenWindow(#WINDOW_Find, 0, 0, #WINDOW_Find_Width, #WINDOW_Find_Height, #PB_Window_SystemMenu | #PB_Window_WindowCentered | #PB_Window_Invisible, Langage(72))
This little trick makes it easy to search for the word under the cursor, as it gets inserted into the find automatically.
@Fred and Danilo
Thanks for a great editor, maybe you could improve on this or add it to the editor for future, this is how many other editors I have used work.
Thanks