1. RichEdit and findText

Its late so I hope someone can supply the answer to my stupid question 
while I sleep!!
  I have a RichEdit in which I'm doing a findText. The findText works 
fine when searching for a single character, but fails to find it if I am
searching for more than one character..

i.e in the RichEdit I have "7028"

This works fine:-
  fnd = findText ( RE, "7", {0,-1}, findDown)
so does this
  fnd = findText ( RE, "0", {0,-1}, findDown)
but..
  fnd = findText ( RE, "7028", {0,-1}, findDown)
returns 0
 Adding the findWholeWord flag also makes no difference..

I'm sure I'm doing something wrong but I can't see what.. Help!

Pete

new topic     » topic index » view message » categorize

2. Re: RichEdit and findText

Pete wrote:
> 
>  Its late so I hope someone can supply the answer to my stupid question 
> while I sleep!!
>   I have a RichEdit in which I'm doing a findText. The findText works 
> fine when searching for a single character, but fails to find it if I am
> searching for more than one character..
> 
> i.e in the RichEdit I have "7028"
> 
> This works fine:-
>   fnd = findText ( RE, "7", {0,-1}, findDown)
> so does this
>   fnd = findText ( RE, "0", {0,-1}, findDown)
> but..
>   fnd = findText ( RE, "7028", {0,-1}, findDown)
> returns 0
>  Adding the findWholeWord flag also makes no difference..
> 
> I'm sure I'm doing something wrong but I can't see what.. Help!

I think I know the problem. Find the 'findText()' function in
the win32lib library and replace ...

    FT = struct_FINDTEXTEX( range[1], range[2], text, 0, 0 )

with ...

    FT = struct_FINDTEXTEX( range[1], range[2], text, 0, -1 )

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

3. Re: RichEdit and findText

Derek Parnell wrote:
> 
> Pete wrote:
> > 
> >  Its late so I hope someone can supply the answer to my stupid question 
> > while I sleep!!
> >   I have a RichEdit in which I'm doing a findText. The findText works 
> > fine when searching for a single character, but fails to find it if I am
> > searching for more than one character..
> > 
> > i.e in the RichEdit I have "7028"
> > 
> > This works fine:-
> >   fnd = findText ( RE, "7", {0,-1}, findDown)
> > so does this
> >   fnd = findText ( RE, "0", {0,-1}, findDown)
> > but..
> >   fnd = findText ( RE, "7028", {0,-1}, findDown)
> > returns 0
> >  Adding the findWholeWord flag also makes no difference..
> > 
> > I'm sure I'm doing something wrong but I can't see what.. Help!
> 
> I think I know the problem. Find the 'findText()' function in
> the win32lib library and replace ...
> 
>     FT = struct_FINDTEXTEX( range[1], range[2], text, 0, 0 )
> 
> with ...
> 
>     FT = struct_FINDTEXTEX( range[1], range[2], text, 0, -1 )
> 
Will this be fixed in the next version?
(also, when do you think the next version
will be ready?)

> -- 
> Derek Parnell
> Melbourne, Australia
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: RichEdit and findText

CoJaBo wrote:
> 
> Derek Parnell wrote:
> > 
> > Pete wrote:
> > > 
> > >  Its late so I hope someone can supply the answer to my stupid question 
> > > while I sleep!!
> > >   I have a RichEdit in which I'm doing a findText. The findText works 
> > > fine when searching for a single character, but fails to find it if I am
> > > searching for more than one character..
> > > 
> > > i.e in the RichEdit I have "7028"
> > > 
> > > This works fine:-
> > >   fnd = findText ( RE, "7", {0,-1}, findDown)
> > > so does this
> > >   fnd = findText ( RE, "0", {0,-1}, findDown)
> > > but..
> > >   fnd = findText ( RE, "7028", {0,-1}, findDown)
> > > returns 0
> > >  Adding the findWholeWord flag also makes no difference..
> > > 
> > > I'm sure I'm doing something wrong but I can't see what.. Help!
> > 
> > I think I know the problem. Find the 'findText()' function in
> > the win32lib library and replace ...
> > 
> >     FT = struct_FINDTEXTEX( range[1], range[2], text, 0, 0 )
> > 
> > with ...
> > 
> >     FT = struct_FINDTEXTEX( range[1], range[2], text, 0, -1 )
> > 
> Will this be fixed in the next version?

Don't know. Did this *actually* fix the problem? If so, 
I can put it in, so I'll wait for confirmation. If I get
time today I'll test it myself but I'm a bit busy right now.

> (also, when do you think the next version
> will be ready?)

I've tentatively pencilled in 30-Nov for the next release. It may
happen earlier, as all I've got to complete is a tiny bit of
documentation and a full regression test (plus this fix if it works).

Actually I've started the testing but I managed to get Judith's IDE
to trip over. 

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

5. Re: RichEdit and findText

Derek Parnell wrote:
> 
> Pete wrote:
> > 
> >  Its late so I hope someone can supply the answer to my stupid question 
> > while I sleep!!
> >   I have a RichEdit in which I'm doing a findText. The findText works 
> > fine when searching for a single character, but fails to find it if I am
> > searching for more than one character..
> > 
> > i.e in the RichEdit I have "7028"
> > 
> > This works fine:-
> >   fnd = findText ( RE, "7", {0,-1}, findDown)
> > so does this
> >   fnd = findText ( RE, "0", {0,-1}, findDown)
> > but..
> >   fnd = findText ( RE, "7028", {0,-1}, findDown)
> > returns 0
> >  Adding the findWholeWord flag also makes no difference..
> > 
> > I'm sure I'm doing something wrong but I can't see what.. Help!
> 
> I think I know the problem. Find the 'findText()' function in
> the win32lib library and replace ...
> 
>     FT = struct_FINDTEXTEX( range[1], range[2], text, 0, 0 )
> 
> with ...
> 
>     FT = struct_FINDTEXTEX( range[1], range[2], text, 0, -1 )
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> 

 Sorry, that didn't help, below is a cut down example (I'm using XP home
 in case it makes any difference)

include win32lib.ew
without warning
with trace

integer res
object VOID
sequence test
test = "test 123456\nwsw 6543\nsd 567\nfe 989\nty 123456\nyh 780\nhu 613\n"

constant
Win = create( Window, "Serial Numbers", 0, Default, Default, 400, 320, 0 ),
SF = create( PushButton, "Search", Win, 140,250, 110, 30, 0),
RE = create( RichEdit, "", Win , 20, 20, 360, 200,ES_NOHIDESEL),

FindWin = create(Window, "Find", Win, 200, 300, 350, 110, {WS_DLGFRAME,
WS_SYSMENU, WS_MINIMIZEBOX} ),
FindButton = create(PushButton, "Find", FindWin, 230, 10, 100, 25, 0),
CancelButton = create(PushButton, "Cancel", FindWin, 230, 40, 100, 25, 0),
FindText = create(EditText, "", FindWin, 65, 20, 140, 25, 0),
FindPrompt = create(LText, "Find What:", FindWin, 10, 25, 55, 20, 0)

--============================================================
procedure FindButtononClick(integer self, integer event, sequence params)
sequence SearchText
integer Ffnd
SearchText = getText(FindText)
if length(SearchText) then
	Ffnd = findText( RE, SearchText, {0, -1}, findDown)
	if Ffnd != 0 then
		setSelection( RE, {Ffnd, Ffnd + 1} )
	else
		? Ffnd
	end if
end if

end procedure
setHandler( FindButton, w32HClick, routine_id("FindButtononClick"))

--===========================================================
procedure CancelButtononClick(integer self, integer event, sequence params)
closeWindow(FindWin)
end procedure
setHandler( CancelButton, w32HClick, routine_id("CancelButtononClick"))

--=============================================================
procedure Search(integer self, integer event, sequence params)
openWindow(FindWin, Modal)
end procedure
setHandler( SF, w32HClick, routine_id("Search"))

--=======================================================
procedure Run(integer self, integer event, sequence params)
putStream( RE, StreamText , test )
end procedure
setHandler( Win, w32HOpen, routine_id("Run"))

--========================================================
WinMain(Win, Normal)


new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu