Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Question: preselect input field with cursor

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Question: preselect input field with cursor
#11324
Posted by: Doug Arndt 2007-07-31 04:40:43
Is it possible to preset one entry field to contain the cursor, so one can just start entering data without having to click that box first ?
I'm sure I'm just missing something obvious here, but I haven't found it.
Doug
Message2.
#11326
Posted by: Jeff Glatt 2007-07-31 05:10:33
Make sure the ENTRY control appears first in the WINDOW definition. The "Grouping" dialog can rearrange control order.
Message3.
#11338
Posted by: Doug Arndt 2007-08-01 05:08:53
Doesn't seem to help, still have to click the entry box to activate a cursor so typing is allowed.
Even making a window with only one entry box, same thing.
Doug
Message4.
#11341
Posted by: Jeff Glatt 2007-08-01 05:29:57
Post a test script.
Message5.
#11344
Posted by: Doug Arndt 2007-08-01 23:48:57
Discovered that when I punch the 'run' button, that it doesn't work, however, if i use 'execute script' or 'start debugger' first, i do get the desired action.

However, it's only good for one iteration.   Try the following test, note that the cursor does come up in the entry box, then press the close button, the second display of the window, no cursor.

/*
GUIBEGIN

WINDOW , 61, 341, 400, 80, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
   FONT 8, 400, MS Shell Dlg
   ENTRY 89, 23, 110, 12, H_AUTO|BORDER|TABSTOP, , MyEntry
   ENTRY 89, 43, 110, 12, H_AUTO|BORDER|TABSTOP
   PUSH 247, 33, 40, 14, TABSTOP, , close, , close
DEND
GUIEND
*/

LIBRARY rexxgui
GuiErr = "SYNTAX"
GuiHeading = 1

GuiCreateWindow('NORMAL')
Do 2
  GuiGetMsg()
end
GuiDestroyWindow()
Return

WM_CLICK_close:
 GuiWake()
   RETURN
Doug
Message6.
#11765
Posted by: Jeff Glatt 2007-09-08 15:28:36
Why do you have a "DO 2" there??? That should be DO FOREVER (and may be the reason for what you're seeing). I also don't get the GuiWake() for the close button. Do a GuiSendMsg(, "POST CLOSE") instead.
Message7. Your problem isn't
#11766
Posted by: Michael S 2007-09-08 15:42:37
as trivial as

guisetctlplacement('entry_control')

is it ?

This places focus in entry_control and you're ready to type
Message8.
#11777
Posted by: DougA 2007-09-09 03:40:22
Michael, perfect, yes it was as trivial as that, that fixes it. 
(put guisetctlplacement('MyEntry') after the Do 2 in my example )
I guess i'm just not 'pulling' this info out of the doc very well.

Sorry Jeff, I was trying to make a simple, short example that showed the cursor is active in the entry box the first time the window is displayed, but the next time guigetmsg is run, no cursor. 
The do 2 demo'ed that, then exited  (not what you'd want in a real program)

However, since you're teaching us something, would you elaborate on the 'POST CLOSE' ?
Doug
Message9.
#11778
Posted by: Jeff Glatt 2007-09-09 04:31:36
"POST" used with GuiSendMsg() means "don't invoke any event handler right here and now on this call to GuiSendMsg. Wait until later when I get around to calling GuiGetMsg again.". "CLOSE" means "cause a CLOSE event", so if you have a CLOSE event handler (WM_CLOSE), then your handler will get called when you do a GuiGetMsg. Essentially, you're causing that button to simulate a CLOSE event as if the user clicked on the window's close box.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-18  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0