FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MDIchild window Focus diferent behavior as FW16
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Wed Oct 17, 2007 04:44 PM

Hello ,

I've tried with other w32 bit programs like excel, etc and when you click any control in the back mdichild window (unfocused) it immediatly brings it to front focused before processing the click event control.
In FW16 it worked like this but in FWH it doesn't anymore.

Can anyone confirms this?

Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
MDIchild window Focus diferent behavior as FW16
Posted: Wed Oct 17, 2007 05:02 PM

Antonio,

Please test samples\TestMdi5.prg and click on the GET from another MDICHILD window. It works fine.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Thu Oct 18, 2007 02:29 PM

Antonio,

Please try testmdi4 and you'll see what I mean. This is not the standard behavior of focus controls inside MDI's. The MDI should be brought to front (focused) immediatly.

Antonio

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
MDIchild window Focus diferent behavior as FW16
Posted: Thu Oct 18, 2007 04:17 PM

AHF,

Testmdi5 is a standard MDI child window and it does work properly.

Testmdi4 is a dialog inside of a MDI child so this is not the same. You are clicking on a control on the dialog not on the MDI child window.

I don't know how to get the behavior you want.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
MDIchild window Focus diferent behavior as FW16
Posted: Thu Oct 18, 2007 05:26 PM

Antonio,

Please review this thread for a very interesting way to avoid the use of a dialog box inside the mdichild:

http://fivetechsoft.com/forums/viewtopi ... parent+mdi

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Fri Oct 19, 2007 10:58 AM

Thanks for your reply, however and although it is a very nice solution for me doesn't work.
I treat every Mdichild container for each dialog that corresponds to a particular program rotine.
I navigate through the dialogs (rotines) foward and backward inside the mdichild.
It is not very common but it has been working without any probelms for some yeras now using FW16.
The only problem in xHarbour is that you can click a chebox or any other control on another child without focusing it it is still active and works wihtout focusing the mdichild.

Is it possible to disable all controls when the mdichild loose focus and enable them when it gain focus again ?

Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
MDIchild window Focus diferent behavior as FW16
Posted: Fri Oct 19, 2007 01:15 PM

Antonio,

Yes, you can disable any control just doing:
oControl:Disable()

and enable it doing:
oControl:Enable()

i.e. to disable all controls of a dialog, or a window, just do:
AEval( oWnd:aControls, { | o | o:Disable() } )

You can use oWnd:bGotFocus = { || AEval( oWnd:aControls, { | o | o:Enable() } ) } and oWnd:bLostFocus = { || AEval( oWnd:aControls, { | o | o:Disable() } ) }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
MDIchild window Focus diferent behavior as FW16
Posted: Fri Oct 19, 2007 04:33 PM

>Is it possible to disable all controls when the mdichild loose focus and enable them when it gain focus again ?

I'm not sure how this is going to solve your problem?

What I think you need to do is to oWndChild:setFocus() when a user clicks on any control.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Mon Oct 22, 2007 04:42 PM

Thanks for your help, now the behaviour it's like win16.

I've solved the problem with the code below following the James idea that clicking in every control should give the focus to windchild.

aEval(odlg:acontrols,{|octrl|(octrl:bgotfocus:= {||::setfocus() })})
nlist1 := len(odlg:acontrols)
for n:= 1 to nlist1
odlg:acontrols[n]:bgotfocus:= {||::setfocus() }
if odlg:acontrols[n]:classname == "TFOLDER"
nlist2 := len(odlg:acontrols[n]:adialogs)
for x := 1 to nlist2
nlist3 := len(odlg:acontrols[n]:adialogs[x]:acontrols)
for z := 1 to nlist3
odlg:acontrols[n]:adialogs[x]:acontrols[z]:bgotfocus:= {||::setfocus() }
next
next
endif
next

Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Tue Oct 23, 2007 09:47 AM

Antonio,

I've forgot that some of controls sometimes have defined elsewere on the code their own bgotfocus blocks. How can I join both code blocks into one ?

Regards Antonio

Regards

Antonio H Ferreira
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
MDIchild window Focus diferent behavior as FW16
Posted: Tue Oct 23, 2007 09:55 AM

bOldGotFocus = oControl:bGotFocus

oControl:bGotFocus = { || Eval( bOldGotFocus ), ... new code ... }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Tue Oct 23, 2007 02:55 PM

Antonio,

I use this code :

nlist1 := len(odlg:acontrols)
for n:= 1 to nlist1
bBlock = odlg:acontrols[n]:bgotfocus
odlg:acontrols[n]:bgotfocus:= {||::setfocus(),eval(bBlock) }
if odlg:acontrols[n]:classname == "TFOLDER"
nlist2 := len(odlg:acontrols[n]:adialogs)
for x := 1 to nlist2
nlist3 := len(odlg:acontrols[n]:adialogs[x]:acontrols)
for z := 1 to nlist3
bBlock = odlg:acontrols[n]:adialogs[x]:acontrols[z]:bgotfocus
odlg:acontrols[n]:adialogs[x]:acontrols[z]:bgotfocus:= {||::setfocus(),eval(bBlock) }
next
next
endif
next

but I get error :

Args:
argumentos <nenhuma>
descrição Class: 'NIL' has no exported method
ficheiro <nenhuma>
genCode 13: EG_NOMETHOD
operação EVAL
osCode (Não é erro do sistema operativo)
severity 2
subCode 1004
subSystem BASE
tries 0

Regards
Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Wed Oct 24, 2007 09:46 AM

I need help on the problem found in my previous message ?

Regards
Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Fri Oct 26, 2007 11:39 AM

Antonio

Do you have any idea on solving the previous problem.

Thanks,

Antonio

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
MDIchild window Focus diferent behavior as FW16
Posted: Mon Nov 05, 2007 11:02 AM

Hello,

After several trials I 'm convince that something is wrong either with xHarbour or FWH.
The windows behaviour on focusing mdichilds is exactly the same for win xp for both 32bits and 16 bits apps and with FW16 it works as expected.
If you try with excel when you have 2 mdichilds and you click the one without focus first it focus first that window, after you must click again to initiate click action on that window. In FH16 it's working like that but FWH isn't anymore.
This brings big problems when programing with Mdichilds where you are in a non modal programing and the events must work absolutly as expected.

FWH March 2006 build
FW16 2.3

Perhaps Antonio Linares could check this ?

Antonio

Regards

Antonio H Ferreira