CSRLOC and MOUBTN
Last Post 10 Dec 2012 09:46 AM by Viking. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Viking
Basic Member
Basic Member
Posts:343

--
07 Dec 2012 01:29 PM

I've got a green screen that uses RTNCSRLOC and CSRLOC and Infds to put the cursor back to the field on the original screen where the user was when they hit F4 to prompt and a selection window (different RPG/DDS) was presented.  This works perfectly when the user uses the keyboard to select the value in the selection window, but if they select the value by clicking the mouse (the window has MOUBTN) the selection value is returned but the cursor stays in the same position it was when the user clicked while the window was up, i.e. not where they were when they hit F4 on the original screen.

Any advice for how to deal with this?

Thanks.

Lynne Noll
Senior Member
Senior Member
Posts:6567

--
07 Dec 2012 01:48 PM
When you put the record back out with the selected values filled in (you have to write the record), set the cursor position. I normally do this with a DSPATR(PC), but if you want something more generic, you can use SETROW and SETCOL. Zero in the row and column values means don't take effect. You can use the values returned to your program to set them.

I remember there being an issue with the position to for input capable fields overriding the value from SETROW, SETCOL unless there was a DSPATR(PC) on the field that was turend OFF. I don't know if this is still an issue.
Viking
Basic Member
Basic Member
Posts:343

--
07 Dec 2012 03:17 PM
Lynne, thanks for your response.

I've got at least 3 fields and maybe more where they can use F4 to select so I'd prefer not to use DSPATR(PC) with indicators on them all and therefore instead have in the DDS CSRLOC(ROW COL) and as soon as they hit F4 I save off their cursor position with:
ROW = infds.CURSOR_ROW;
COL = infds.CURSOR_COL;
Then after returning from the window I EXFMT to show the screen again and then clear ROW and COL and wait for new user input.
This works great except it wasn't working when the user clicked the mouse to make the selection on the window. I guess my question is why does clicking the mouse in the window program somehow affect the CSRLOC positioning of the cursor in the calling program differently than making the selection with the keyboard?

However, I now have it working properly... I found an old post from 2010 where you in response to a different problem suggested defining MOUBNT(*ULP *ULR CF09), i.e. with both *ULP and *ULR instead of just *ULP. I tried this and it fixed my problem! I don't quite understand why but now the cursor goes back to whatever field it came from whether I select with the keyboard or the mouse!

So you've helped me with a 2 1/2 year old post - thanks! :-)
Viking
Basic Member
Basic Member
Posts:343

--
10 Dec 2012 09:46 AM
Everything is working fine - thanks.
You are not authorized to post a reply.

Acceptable Use Policy