Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

cursor position in editbox after callback

presser
Beginner
418 Views
Hallo,
I'm bothered with the same problem, when entering numbers in the edit box, the order is reversed. It happened after a call to DlgSet( DLG_COLOR ). Now I found out that this problem will not occur, when in XFLOGM.f90 -Version of Mr. Dujic, which I use - the statements
! Note that the dialog needs to be updated
!!!*** dlg % dirty = .true.
!!!*** dlg % list(i) % dirty = .true.
are commented, whatever that means. Maybe this will be a help to you, unless you have solved your problem otherwise.
WP
0 Kudos
3 Replies
isn-removed200637
418 Views

If the edit box callback routine handles the edit box message by reading the contents (using DLGGET)and then updating it again, using DLGSET, then I have found this annoying thing to happen, what you type spreads out to the left from the cursor position. My work-around is to create an invisible button and make it the default button (only one control can be the default in a dialog box), so that when ENTER is pressed after ending your editing of the edit box contents, the default button's code is sent to its call-back routine (which can be the same as the edit box's call back) and it can be handled and the edit box contents can then be read and updated as you like. The edit box contents are then only updated when you press ENTER (so long asa you remove any DLGSET to the edit box when handling the edit box message in its call back routine). Hope this helps.

0 Kudos
Jugoslav_Dujic
Valued Contributor II
418 Views

Am I missing the original post in this thread? I can only guess what the original problem was.

I think (without digging into code and without seeing the original post) that the problem is that SetWindowText/WM_SETTEXT for edit control places the cursor at the end of selection. If you do that in the middle of user's typing, that could certainly be annoying.

I think the workaround could be to place something like following into DLG_UPDATE/DLG_CHANGE callback:

i = DlgSendCtrlMessage(Dlg, IDC_EDIT1, EM_GETSEL, LOC(iStart), LOC(iEnd))
!Digest contents of edit box
i = DlgSet(Dlg, IDC_EDIT1, whatever)
i = DlgSendCtrlMessage(Dlg, IDC_EDIT1, EM_SETSEL, iStart, iEnd)

In this way, the caret should stay in the same position as it was before the user's typing.

Jugoslav

0 Kudos
Steven_L_Intel1
Employee
418 Views
The first part of the thread is here.
There is a forum bug where if you are not logged in and click Reply, after logging in you're taken to a pseudo-new-message form.

Message Edited by MADsblionel on 11-29-2003 04:09 PM

0 Kudos
Reply