MDIchild window Focus diferent behavior as FW16

AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

MDIchild window Focus diferent behavior as FW16

Post by AHF »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

>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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

bOldGotFocus = oControl:bGotFocus

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

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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

Regards
Antonio
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

Antonio

Do you have any idea on solving the previous problem.

Thanks,

Antonio
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Post by AHF »

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
Post Reply