August 22, 2019, 12:14:23 pm

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Recent posts

Pages 1 2 3 4 ... 10
11
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 05, 2019, 07:15:48 pm
Fantastic idea!!!  I love it, never even thought about it, but yes.  Will definitely make it easier on the user.  Will add code as soon as possible.

Thank you,
Bill
12
GUI Central / Re: Tabbing backwards in Dialo...
Last post by fasecero - August 05, 2019, 06:53:15 pm
No problem. Thanks. One final sugestion, you could changle the background color of the focused edit to give the costumer a visual "clue" about where the focus resides, taking into account the number of input controls.

Code Select
SUB FocusInit(INT firstID, INT lastID)
INT j

' subclass all edits
FOR j = firstID TO lastID
SetWindowSubclass(GetDlgItem(wOpp0100c.hwnd, j), &subclassProc, subclassID, 0)
NEXT j

' get the focused edit and change its background color
INT handle = GetFocus()

IF handle THEN
INT id = GetDlgCtrlID(handle)
IF id THEN SETCONTROLCOLOR(wOpp0100c, id, RGB(0,0,0), RGB(80,220,100))
ENDIF
ENDSUB

SUB FocusNextEdit(INT focusedID, INT firstID, INT lastID, INT direction)
INT nextID = focusedID
INT nextHWND = 0

' skip if disabled
DO
nextID = nextID + direction
IF nextID = lastID + 1 THEN nextID = firstID
IF nextID = firstID - 1 THEN nextID = lastID
nextHWND = GetDlgItem(wOpp0100c.hwnd, nextID)
UNTIL IsWindowEnabled(nextHWND)

' change backcolors
SETCONTROLCOLOR(wOpp0100c, nextID, RGB(0,0,0), RGB(80,220,100))
SETCONTROLCOLOR(wOpp0100c, focusedID, RGB(0,0,0), RGB(255,255,255))

' set current focus
_SetFocus(nextHWND)
ENDSUB
13
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 05, 2019, 04:40:42 pm
Never mind, I figured it out.  That code needs to be in the Handler.

Thanks for all the help.  Wish I could understand what you did, but will definitely try to understand the logic you used.  Very interesting, but it does exactly what I have been trying to do.  I have been fooling with this for over a week.

So, thank you again,
Bill
14
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 05, 2019, 04:17:42 pm
Added the new code and it works exactly as what I am looking for.  Only one more (hopefully minor) addition.

I added:  CONTROLCMD wOpp0100c,nextHWND,@EDSETSELECTION,0,-1 to the end.  However, it does not seem to select the entire field when there is a value in it.

Thanks,
Bill

15
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 05, 2019, 04:11:25 pm
If I was dealing with PC people, then yes, up and down would be easier, but this is replacing a program that was originally written on an iSeries (AS/400), old green screen.  So, they are used to tabbing to get around.

Will add code from first revision to see what it does.

Funny, when I add your code to my original, it complains about not finding VK_RETURN, but when using yours it does not.  Where is VK_RETURN defined?

Thanks,
Bill
16
GUI Central / Re: Tabbing backwards in Dialo...
Last post by fasecero - August 05, 2019, 03:05:26 pm
And how about moving to next and previous edit using UP AND DOWN keys, quite intuitive

Code Select
SUB subclassProc(hWnd:INT,uMsg:INT,wParam:INT,lParam:INT,uIdSubclass:UINT_PTR,dwRefData:DWORD_PTR),INT
SELECT uMsg
CASE WM_KEYDOWN
SELECT wParam
CASE VK_RETURN
CASE& VK_TAB
IF GetKeyState(VK_SHIFT) THEN
FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21, -1)
ELSE
FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21, 1)
ENDIF
RETURN 0

CASE VK_UP
FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21, -1)
RETURN 0
CASE VK_DOWN
FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21, 1)
RETURN 0
ENDSELECT
ENDSELECT

RETURN DefSubclassProc(hWnd, uMsg, wParam, lParam)
ENDSUB
17
GUI Central / Re: Tabbing backwards in Dialo...
Last post by fasecero - August 05, 2019, 02:57:48 pm
OK. I've added your revisions. I've worked for fun a bit more around your code. Now skip any disabled control and will go backwards pressing shift + tab. Good Luck!

Code Select
SUB subclassProc(hWnd:INT,uMsg:INT,wParam:INT,lParam:INT,uIdSubclass:UINT_PTR,dwRefData:DWORD_PTR),INT
SELECT uMsg
CASE WM_KEYDOWN
SELECT wParam
CASE VK_RETURN
CASE& VK_TAB
IF GetKeyState(VK_SHIFT) THEN
FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21, -1)
ELSE
FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21, 1)
ENDIF

RETURN 0
ENDSELECT
ENDSELECT

RETURN DefSubclassProc(hWnd, uMsg, wParam, lParam)
ENDSUB

SUB FocusNextEdit(INT focusedID, INT firstID, INT lastID, INT direction)
INT nextID = focusedID
INT nextHWND = 0

' skip if disabled
DO
nextID = nextID + direction
IF nextID = lastID + 1 THEN nextID = firstID
IF nextID = firstID - 1 THEN nextID = lastID
nextHWND = GetDlgItem(wOpp0100c.hwnd, nextID)
UNTIL IsWindowEnabled(nextHWND)

' set current focus
_SetFocus(nextHWND)
ENDSUB
18
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 05, 2019, 02:09:17 pm
I got the program to work that way with the old way I was doing it.  But I need to allow the user to go forwards and backwards via tab and back-tab.  I was hoping for logic that would recognize the enter key and I would handle it in that code to move forward.  Still looking to figure out how to read an ENTER key and know that it was pressed, so I can handle the moving forward.

Also, made 2 changes to your code:

FocusNextEdit(GetDlgCtrlID(hWnd), ce02, ce21)

You had ce00, but ce00 and ce01 are there for viewing only, not entering.

IF focusedID = lastID THEN nextID = firstID

was

IF focusedID = lastID THEN nextID = lastID

This allows the program to roll back to the top after hitting the bottom.

Also, when I tested the code, I don't know why, but it stopped at the 'Comment Code', but when I clicked into 'Invoice Handling Code', it continued tabbing just fine.  Which is very strange, considering it went thru every edit box, might be since CE19 is not enabled?

Thanks for looking into it.

Bill
19
GUI Central / Re: Tabbing backwards in Dialo...
Last post by fasecero - August 05, 2019, 01:36:57 pm
Is this what you're looking for? Had to remove some code and change some edit styles to get it to work. The focus goes to the next edit when the costumer press ENTER or TAB.
20
GUI Central / Re: Tabbing backwards in Dialo...
Last post by billhsln - August 05, 2019, 09:59:16 am
Right now all I want is to be able to tell when the user presses the ENTER key.  No matter what I do, it does not show the MESSAGEBOX that I have defined for either the @IDCHAR or the @IDKEYDOWN.  I will end up leaving the tab working as it does, because it now goes back and forth.  Just wanted to allow the user to move forward when pressing the ENTER key, but I can't seem to get it be even be recognized.

Hopefully some one can give me a hint as to what I am doing wrong.

Thanks,
Bill
Pages 1 2 3 4 ... 10