1. RE: How can I make a field ready to receive typing?

Louis
Never had a problem with setFocus when used within a w32HActivate 
routine.  However, I have often used it followed by a setIndex in order 
to position the cursor at some point within the editText field or to 
select all the text in a prefilled field. 

You could try that..... Rangi

Louis at cwshop.com wrote:
> 
> 
> OK, Thanks.  I tried it and
> WinMain( {firstwindow, focuscontrol}, Normal )
> Does exactly the same thing as setFocus(focuscontrol).
> Oh well.
> 
> Wishlist items:
> Add a line to Win32Lib:
> global constant 	WS_NO_RESIZE = {WS_CAPTION,WS_SYSMENU}
> 
> And, as time permits, add a short comment to constants like this in the 
> source that describes what they do, in lieu of documentation.  Then I 
> could browse (and search) Win32Lib source to find the flags that I need, 
> since they are not listed in the main documentation.  Even mentioning in 
> the documentation where constants starting with "WS_" (and other 
> prefixes too) are used would be of some help.  For example, in the 
> documentation for "create()", you could mention that the names for flag 
> constants start with "WS_" and for createEx() you could say what the 
> prefix for exFlags constants are.
> 
> Louis.
> 
> *********** REPLY SEPARATOR  ***********
> 
> On 10/8/2003 at 2:14 PM Derek Parnell wrote:
> 
> >
> >----- Original Message -----
> >From: <Louis at cwshop.com>
> >To: "EUforum" <EUforum at topica.com>
> >Sent: Wednesday, October 08, 2003 8:47 AM
> >Subject: How can I make a field ready to receive typing?
> >
> >> My windows are working fine.  However, when the input window opens, the
> >cursor is nowhere to be seen.  I must either click on the input field or
> >hit TAB to produce a cursor so that I can type in the field.
> >
> >Try this ...
> >
> >  WinMain( {firstwindow, focuscontrol}, Normal)
> <snip>
> 
>

new topic     » topic index » view message » categorize

2. RE: How can I make a field ready to receive typing?

> From: Louis at cwshop.com [mailto:Louis at cwshop.com] 
> 
> 
> OK Derek, thanks for your help.  Your example does work, BUT...
> 
> What I am trying to do is open a window at the beginning of 
> the program to check for a password, and if entered 
> correctly, then close the password window and open the main 
> window.  I find the initial window is considered the "main" 
> window and I cannot close it without killing off the entire 
> windowing system.  Therefore, I open a secondary window to 
> prompt for the password, but when I do this I must click on 
> the field or tab to it before typing is possible.
> 
> 
> procedure Open_Win2(integer self, integer event, sequence parms)
>     openDialog(Win2)
>     setFocus(Text21)   -- This doesn't do anything   sad
> end procedure
> setHandler(MainWin, w32HActivate, routine_id("Open_Win2"))

You need an onActivate handler for Win2:

procedure Activate_Win2(integer self, integer event, sequence parms)
    setFocus(Text21)
end procedure
setHandler(Win2, w32HActivate, routine_id("Activate_Win2"))

The reason for this is that when you use openDialog(), you start a nested
message loop, so the call to setFocus() doesn't happen until the dialog is
closed.

Matt Lewis

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

3. RE: How can I make a field ready to receive typing?

Here are the results of your suggestions on my Win2000 SP4 system:

Suggestion 1:
Remove setFocus from Open_Win2 and add:
procedure Activate_Win2(integer self, integer event, sequence parms)
    setFocus(Text21)
end procedure
setHandler(Win2, w32HActivate, routine_id("Activate_Win2"))

Result:  The password field does get focus, because one TAB takes me to=
 Text22, however the password field does not open for input.  No cursor.=
  Typing does not appear in the window (or anywhere else).  Both windows=
 are visible and when the password window is closed, the initial focus=
 window is fully exposed and has not changed size.

Suggestion 2:
Change openDialog to OpenWindow

Result:  Works in the simple example, but in the real application execution=
 proceeds beyond the OpenWindow and I loose control - the code immediately=
 following gets run without waiting for the PW window to close, but I can=
 move that code somewhere else.

Suggestion 3:
Put the main window off screen initially.

That's real cute.  I never would have thought of that; I would have=
 supposed it would result in an error.  What I have been doing is to place=
 the password window exactly on top of the main window, but the user can=
 move the password window and expose it.

Suggestion 4:
Make the password window modal.

Good point.  Maybe not necessary if the main window is off screen, but=
 still a good idea.

Comment by Derek:
    Here's how it works for me:
    1. Password text field is highlighted upon start.
    2. When password dialog is dismissed, main screen comes in at position=
 0,0
     and size 300,300 as defined.

Do you mean that the main window is not visible until the password window=
 is closed?  On my system they both appear at the outset with the password=
 window in front of the main window.

Suggestion 5:
procedure MyWin_onActivate (integer self, integer event, sequence
params)--params is ()

I understand that the onXXX functions should not be used for new code.=
  They also kill the setHandler statements.

-------------

This has been really educational.  I hope others have learned as much as I=
 have.  I'm not closing the discussion, but I think I have learned enough=
 to make my application work the way I want.  Although there is a practical=
 need for the program I am writing, I am also doing it for fun.  I have=
 been known to rip out perfectly good code and replace it with something=
 that is more elegant or beautiful when I learn more.  Thanks, guys.

Louis.

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

4. RE: How can I make a field ready to receive typing?

Derek -

Ditto for me. I get the same results with my WIN98. I also have the same 
versions that C.K. has.

Mike W.

C. K. Lester wrote:
> 
> 
> > > Here's how it "works" for me:
> > >
> > > 1. Password text field not highlighted upon start.
> > > 2. When password dialog is dismissed, main screen comes in with size 0,0
> > > (not 300,300 as defined).
> > >
> > > I'm using Win2K, EU2.4, and Win32Lib latest 'n' greatest.
> >
> > Here's how it works for me:
> > 1. Password text field is highlighted upon start.
> > 2. When password dialog is dismissed, main screen comes in at position 
> > 0,0
> >  and size 300,300 as defined.
> > I'm using WinME, EU2.4, and Win32Lib latest.
> 
> Derek, FYI...
> 
> I just tried the code on my Win98, Win32Lib 0.59, and EU2.4 and got the
> exact same results as I got on my Win2K box, namely:
> 
> 1. Password text field not highlighted upon start. (Pressing TAB gets me
> into "Text22" box.)
> 2. When password dialog is dismissed, main screen comes in with size 0,0
> (not 300,300 as defined).
> 
>

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

5. RE: How can I make a field ready to receive typing?

All,

Same result here.  I have WinXP Home, Eu 2.4, and Win32Lib 59.1.

Andrew Hall

-----Original Message-----
From: Michael Wisolmerski [mailto:MWisolmerski at mayors.com] 
Subject: RE: How can I make a field ready to receive typing?



Derek -

Ditto for me. I get the same results with my WIN98. I also have the same 
versions that C.K. has.

Mike W.

C. K. Lester wrote:
> 
> 
> > > Here's how it "works" for me:
> > >
> > > 1. Password text field not highlighted upon start.
> > > 2. When password dialog is dismissed, main screen comes in with size
0,0
> > > (not 300,300 as defined).
> > >
> > > I'm using Win2K, EU2.4, and Win32Lib latest 'n' greatest.
> >
> > Here's how it works for me:
> > 1. Password text field is highlighted upon start.
> > 2. When password dialog is dismissed, main screen comes in at position 
> > 0,0
> >  and size 300,300 as defined.
> > I'm using WinME, EU2.4, and Win32Lib latest.
> 
> Derek, FYI...
> 
> I just tried the code on my Win98, Win32Lib 0.59, and EU2.4 and got the
> exact same results as I got on my Win2K box, namely:
> 
> 1. Password text field not highlighted upon start. (Pressing TAB gets me
> into "Text22" box.)
> 2. When password dialog is dismissed, main screen comes in with size 0,0
> (not 300,300 as defined).
> 
> 



TOPICA - Start your own email discussion group. FREE!

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

6. RE: How can I make a field ready to receive typing?

This is interesting.
It appears that "setCtlPosition(MainWin, 0,0)" does not do what I first=
 assumed.  This is more clear if the main window opens initially at=
 200,200,....  When setCtlPosition() executes, the main window is NOT=
 moved.  The top left corner is dragged to the specified coordinates,=
 enlarging the window.  I expect that when the top left corner is dragged=
 down and to the right beyond the bottom right corner, the window will=
 shrink to the minimum size.

To make it MOVE the window, we must use TWO commands instead:
setCtlPosition(MainWin, 200, 200)  -- Push the bottom right corner into=
 place
setCtlPosition(MainWin,     0,    0)  -- Stretch the window by the upper=
 left corner to size

Is that what setCtlPosition() is supposed to do?

Louis.

*********** REPLY SEPARATOR  ***********

On 10/10/2003 at 6:01 PM cheetah_heels at myrealbox.com wrote:

>
>
>All,
>
>Same result here.  I have WinXP Home, Eu 2.4, and Win32Lib 59.1.
>
>Andrew Hall

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

7. RE: How can I make a field ready to receive typing?

>From: Louis at cwshop.com
>Subject: RE: How can I make a field ready to receive typing?
>
>
>This is interesting.
>It appears that "setCtlPosition(MainWin, 0,0)" does not do what I first 
>assumed.  This is more clear if the main window opens initially at 
>200,200,....  When setCtlPosition() executes, the main window is NOT moved. 
>  The top left corner is dragged to the specified coordinates, enlarging 
>the window.  I expect that when the top left corner is dragged down and to 
>the right beyond the bottom right corner, the window will shrink to the 
>minimum size.
>
>To make it MOVE the window, we must use TWO commands instead:
>setCtlPosition(MainWin, 200, 200)  -- Push the bottom right corner into 
>place
>setCtlPosition(MainWin,     0,    0)  -- Stretch the window by the upper 
>left corner to size
>
>Is that what setCtlPosition() is supposed to do?

  No, it is not working right. The problem is that getRect() returns the 
positions of the top-left and bottom-right corners, and that setRect() sets 
the top-left corner, and the *height*, and the *width*, not the position of 
the bottom-right corner. setCtlPosition() does not adjust for this. It 
should use getCtlSize() instead of getRect().

global procedure setCtlPosition(integer id, object x, object y)
    sequence lSize

    lSize = getCtlSize(id)
    setRect(id, x, y, lSize[1], lSize[2], 1)

end procedure


>
>Louis.
>

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

8. RE: How can I make a field ready to receive typing?

Try this.  I think this is exactly what I want.

Louis.

without warning
include win32lib.ew

integer MainWin, Win2
integer Text1
integer Text2
integer Text3
integer Text21
integer Text22
integer Text23

MainWin =3D create(Window,   "Initial Focus",0,     0,  0, 300, 300, 0)
Text1   =3D create(EditText, "Not here", MainWin,   5,  5, 200,  25, 0)
Text2   =3D create(EditText, "This is it", MainWin, 5, 35, 200,  25, 0)
Text3   =3D create(EditText, "Nor here", MainWin,   5, 65, 200,  25, 0)

Win2    =3D create(Window,   "Window 2",  MainWin, 50, 50, 300, 300, 0)
Text21  =3D create(EditText, "Password",     Win2,  5,  5, 200,  25, 0)
Text22  =3D create(EditText, "Text22",       Win2,  5, 35, 200,  25, 0)
Text23  =3D create(EditText, "Text23",       Win2,  5, 65, 200,  25, 0)

procedure Activate_MainWin(integer self, integer event, sequence parms)
    showWindow(MainWin, SW_HIDE)  -- Hide main window
    openWindow(Win2, Normal)   -- Window opens and execution continues
    setFocus(Text21)   -- Set focus to password field
end procedure

procedure Close_Win2(integer self, integer event, sequence parms)
    showWindow(MainWin, SW_NORMAL)  -- PW window closed, now open main=
 window
end procedure

setHandler(MainWin, w32HActivate, routine_id("Activate_MainWin"))
setHandler(Win2, w32HClose, routine_id("Close_Win2"))

WinMain(MainWin, Normal)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu