Hello,
Here i am again...
There are 2 dialogs. (seperate thread, not the same GetList)
1 dialog contains Dc_Xbpget's
Another dialog contains only pushbuttons (keyboard) ALWAYSONTOP.
The input focus is on any Dc_Xbpget (can be any of many)
If i click on a button in the 2nd dialog then:
1. The first dialog goes out of focus.
2. The input field goes out of focus.
3. My 2nd window gets focus.
4. My pushbutton ACTION is executed.
In my pushbutton ACTION i want to send a key (for example a "A") to the Dc_Xbpget that had the previous focus (in the other dialog), and set focus to that Dc_Xbpget. If possible, without flickering......
Is the someone that has an ingenious solution for this.
Regards,
Jack Duijf.
P.s. My goal is to have a generic touchscreen keyboard for any of the dialogs in my application.
Find previous focus.
Find previous focus.
Regards,
Jack Duijf
Jack Duijf
Re: Find previous focus.
Jack -
I added some new code to _DCCLASS.PRG to make this possible.
Here is what you need to do:
1. Add the following 3 lines of code to the DC_XbaseParts:setOrig() method just before the return.
2. Add the following new functions to _DCCLASS.PRG:
Now here is the test code I used:
I added some new code to _DCCLASS.PRG to make this possible.
Here is what you need to do:
1. Add the following 3 lines of code to the DC_XbaseParts:setOrig() method just before the return.
Code: Select all
IF _IsEditControl(oXbp)
oXbp:setInputFocus := DC_MergeBlocks(oXbp:setInputFocus,{||DC_LastInputFocus(oXbp)})
ENDIF
Code: Select all
FUNCTION DC_LastInputFocus( oXbp )
STATIC soFocus := nil
IF Valtype(oXbp) == 'O'
soFocus := oXbp
ENDIF
RETURN soFocus
* -------------
STATIC FUNCTION _IsEditControl( oXbp )
IF Valtype(oXbp) # 'O'
RETURN .f.
ENDIF
RETURN oXbp:isDerivedFrom('DC_XbpGet') .OR. ;
oXbp:isDerivedFrom('DC_XbpSle') .OR. ;
oXbp:isDerivedFrom('DC_XbpRadioButton') .OR. ;
oXbp:isDerivedFrom('DC_XbpComboBox') .OR. ;
oXbp:isDerivedFrom('DC_XbpListBox') .OR. ;
oXbp:isDerivedFrom('DC_XbpCheckBox') .OR. ;
oXbp:isDerivedFrom('DC_XbpSpinButton') .OR. ;
oXbp:isDerivedFrom('DC_XbpMle') .OR. ;
oXbp:isDerivedFrom('DC_Xbp3State')
Now here is the test code I used:
Code: Select all
#INCLUDE "dcdialog.ch"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList[0], aGets[10], i
AFill( aGets,Space(10) )
FOR i := 1 TO Len(aGets)
@ i,1 DCGET aGets[i]
NEXT
DCREAD GUI FIT SETAPPWINDOW ;
EVAL {|oDlg,oThread|oThread := Thread():new(), Sleep(5), oThread:start({||Keyboard()})}
RETURN nil
* ----------
PROC appsys ; RETURN
* ----------
FUNCTION Keyboard()
LOCAL GetList[0], i, nCol := 0
FOR i := 65 TO 65+25
nCol += 3
@ 0,nCol DCPUSHBUTTON CAPTION Chr(i) SIZE 3 ;
ACTION ActionBlock(i)
NEXT
DCREAD GUI FIT TITLE 'Keyboard'
RETURN nil
* ----------
STATIC FUNCTION ActionBlock( i )
RETURN {|o| o := DC_LastInputFocus(), o:keyboard(i), o:getData() }
The eXpress train is coming - and it has more cars.
Re: Find previous focus.
Hello Roger,
Thank you, this does almost the things i want.
This is a huge step forward. I need to fiddle a bit with my code get get it right.
Regards,
Jack Duijf
Thank you, this does almost the things i want.
This is a huge step forward. I need to fiddle a bit with my code get get it right.
Regards,
Jack Duijf
Regards,
Jack Duijf
Jack Duijf
Re: Find previous focus.
hello Roger!
Can you please post the new/changed _DCCLASS.PRG
(there are several place where the changes must be made)
thanks
Can you please post the new/changed _DCCLASS.PRG
(there are several place where the changes must be made)
thanks
best regards
Hans
Hans
-
- Posts: 147
- Joined: Thu Jan 28, 2010 9:24 am
- Location: Nitra, Slovakia
- Contact:
Re: Find previous focus.
Hi Roger,
please, can you also add any method/function for saving and then restoring position in GET when loosing focus and restoring focus from another running thread/window or apps when it was selected via Alt+Tab or from TaskBar, Desktop etc.
Regards
Zdeno
s pozdravom
zdeno bielik
ace system, spol. s r.o.
štiavnická 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 – 328 888
... s nami dostávate vždy viac
please, can you also add any method/function for saving and then restoring position in GET when loosing focus and restoring focus from another running thread/window or apps when it was selected via Alt+Tab or from TaskBar, Desktop etc.
Regards
Zdeno
s pozdravom
zdeno bielik
ace system, spol. s r.o.
štiavnická 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 – 328 888
... s nami dostávate vždy viac
Re: Find previous focus.
That feature was put into eXpress++ several years ago.please, can you also add any method/function for saving and then restoring position in GET when loosing focus and restoring focus from another running thread/window or apps when it was selected via Alt+Tab or from TaskBar, Desktop etc.
It automatically restores focus to the last object that had focus when clicking back on the parent window.
The eXpress train is coming - and it has more cars.
Re: Find previous focus.
File is attached.Can you please post the new/changed _DCCLASS.PRG
- Attachments
-
- _dcclass.zip
- (38.45 KiB) Downloaded 804 times
The eXpress train is coming - and it has more cars.
-
- Posts: 147
- Joined: Thu Jan 28, 2010 9:24 am
- Location: Nitra, Slovakia
- Contact:
Re: Find previous focus.
Roger,rdonnay wrote:position in GET
It automatically restores focus to the last object that had focus when clicking back on the parent window.
yes, previosly last active get object is restored and focus is set on it, but cursor is always set on first position instead of that, what position was when object did lost focus.
Zdeno
s pozdravom
zdeno bielik
ace system, spol. s r.o.
štiavnická 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 – 328 888
... s nami dostávate vždy viac