1. RE: Highlighting edittext boxes

> I have a program with lots of little text boxes on screen.
> I can tab from one to another with - guess - the Tab key.
> The selected box just shows a dotted rectangle around it,
> but I need it to go inverse-video or otherwise highlight
> decently so it can be seen easily.  I can't find how to do
> this among the myriads of Windows messages of various types.
> Can anyone advise me? I can do it for a ListView box with advice
> from someone here but I forget whom. And it doesn't want to work
> with simple edit text boxes. So ...
> Andy Drummond

Ello Andy, heres a simple short example for ya.

==========
include Win32Lib.ew
without warning

constant
MainWin		= create( Window, "Testing", NULL, 0.25, 0.25, 0.5, 0.5, 0 ),
Edit1		= create( EditText, "text1", MainWin, 10, 10, 150, 20, 0 ),
Edit2		= create( EditText, "text2", MainWin, 10, 40, 150, 20, 0 ),
Edit3		= create( EditText, "text3", MainWin, 10, 70, 150, 20, 0 )

procedure InverseVideo()
    atom Void
    Void = sendMessage( getSelf(), EM_SETSEL, 0, -1 )
end procedure
onGotFocus[ Edit1 ] = routine_id( "InverseVideo" )
onGotFocus[ Edit2 ] = routine_id( "InverseVideo" )
onGotFocus[ Edit3 ] = routine_id( "InverseVideo" )

WinMain( MainWin, Normal )
==========

new topic     » topic index » view message » categorize

2. RE: Highlighting edittext boxes

Alternatively, you could do it this way:
----------------------------------------
include Win32Lib.ew
without warning

constant
   MainWin = create( Window, "Testing", 0, Default, Default, 
                                           200, 150, 0 ),
   Edit1 = create( EditText, "text1", MainWin, 10, 10, 150, 20, 0 ),
   Edit2 = create( EditText, "text2", MainWin, 10, 40, 150, 20, 0 ),
   Edit3 = create( EditText, "text3", MainWin, 10, 70, 150, 20, 0 )

procedure InverseVideo(integer self, integer event, sequence parms)
   setIndex(self,{1,0})
end procedure
setHandler({Edit1,Edit2,Edit3},w32HGotFocus,
                               routine_id("InverseVideo"))

WinMain( MainWin, Normal )
----------------------------------------

-- Brian


Don Phillips wrote:
> > I have a program with lots of little text boxes on screen.
> > I can tab from one to another with - guess - the Tab key.
> > The selected box just shows a dotted rectangle around it,
> > but I need it to go inverse-video or otherwise highlight
> > decently so it can be seen easily.  I can't find how to do
> > this among the myriads of Windows messages of various types.
> > Can anyone advise me? I can do it for a ListView box with advice
> > from someone here but I forget whom. And it doesn't want to work
> > with simple edit text boxes. So ...
> > Andy Drummond
> 
> Ello Andy, heres a simple short example for ya.
> 
> ==========
> include Win32Lib.ew
> without warning
> 
> constant
> MainWin		= create( Window, "Testing", NULL, 0.25, 0.25, 0.5, 0.5, 0 ),
> Edit1		= create( EditText, "text1", MainWin, 10, 10, 150, 20, 0 ),
> Edit2		= create( EditText, "text2", MainWin, 10, 40, 150, 20, 0 ),
> Edit3		= create( EditText, "text3", MainWin, 10, 70, 150, 20, 0 )
> 
> procedure InverseVideo()
>     atom Void
>     Void = sendMessage( getSelf(), EM_SETSEL, 0, -1 )
> end procedure
> onGotFocus[ Edit1 ] = routine_id( "InverseVideo" )
> onGotFocus[ Edit2 ] = routine_id( "InverseVideo" )
> onGotFocus[ Edit3 ] = routine_id( "InverseVideo" )
> 
> WinMain( MainWin, Normal )
> ==========
> 
>

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

3. RE: Highlighting edittext boxes

And I just thought of another even cleaner method.  Just an example of 
the many possible ways to accomplish the same thing...
----------------------------------------
include Win32Lib.ew
without warning

constant
   Win = create( Window, "Test", 0, Default, Default, 200, 150, 0 ),
   Edt = { create( EditText, "text1", Win, 10, 10, 150, 20, 0 ),
           create( EditText, "text2", Win, 10, 40, 150, 20, 0 ),
           create( EditText, "text3", Win, 10, 70, 150, 20, 0 ) }

procedure InverseVideo(integer self, integer event, sequence parms)
   setIndex(self,{1,0})
end procedure
setHandler( Edt, w32HGotFocus, routine_id("InverseVideo") )

WinMain( Win, Normal )
----------------------------------------
-- Brian
Brian Broker wrote:
> Alternatively, you could do it this way:
> ----------------------------------------
> include Win32Lib.ew
> without warning
> 
> constant
>    MainWin = create( Window, "Testing", 0, Default, Default, 
>                                            200, 150, 0 ),
>    Edit1 = create( EditText, "text1", MainWin, 10, 10, 150, 20, 0 ),
>    Edit2 = create( EditText, "text2", MainWin, 10, 40, 150, 20, 0 ),
>    Edit3 = create( EditText, "text3", MainWin, 10, 70, 150, 20, 0 )
> 
> procedure InverseVideo(integer self, integer event, sequence parms)
>    setIndex(self,{1,0})
> end procedure
> setHandler({Edit1,Edit2,Edit3},w32HGotFocus,
>                                routine_id("InverseVideo"))
> 
> WinMain( MainWin, Normal )
> ----------------------------------------
> 
> -- Brian

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

4. RE: Highlighting edittext boxes

Brian,
Thanks for the ideas - I will try them as soon as I can.
I thought it better to say thanks now as it's the weekend here now so
I'll not be doing it till Wednesday (!) now. Thanks again.
Andy

Brian Broker wrote:
> And I just thought of another even cleaner method.  Just an example of 
> the many possible ways to accomplish the same thing...
> ----------------------------------------
> include Win32Lib.ew
> without warning
> 
> constant
>    Win = create( Window, "Test", 0, Default, Default, 200, 150, 0 ),
>    Edt = { create( EditText, "text1", Win, 10, 10, 150, 20, 0 ),
>            create( EditText, "text2", Win, 10, 40, 150, 20, 0 ),
>            create( EditText, "text3", Win, 10, 70, 150, 20, 0 ) }
> 
> procedure InverseVideo(integer self, integer event, sequence parms)
>    setIndex(self,{1,0})
> end procedure
> setHandler( Edt, w32HGotFocus, routine_id("InverseVideo") )
> 
> WinMain( Win, Normal )
> ----------------------------------------
> -- Brian
> Brian Broker wrote:
> > Alternatively, you could do it this way:
> > ----------------------------------------
> > include Win32Lib.ew
> > without warning
> > 
> > constant
> >    MainWin = create( Window, "Testing", 0, Default, Default, 
> >                                            200, 150, 0 ),
> >    Edit1 = create( EditText, "text1", MainWin, 10, 10, 150, 20, 0 ),
> >    Edit2 = create( EditText, "text2", MainWin, 10, 40, 150, 20, 0 ),
> >    Edit3 = create( EditText, "text3", MainWin, 10, 70, 150, 20, 0 )
> > 
> > procedure InverseVideo(integer self, integer event, sequence parms)
> >    setIndex(self,{1,0})
> > end procedure
> > setHandler({Edit1,Edit2,Edit3},w32HGotFocus,
> >                                routine_id("InverseVideo"))
> > 
> > WinMain( MainWin, Normal )
> > ----------------------------------------
> > 
> > -- Brian
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu