Page 1 of 2
MDIchild window Focus diferent behavior as FW16
Posted: Wed Oct 17, 2007 4:44 pm
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
Posted: Wed Oct 17, 2007 5:02 pm
by Antonio Linares
Antonio,
Please test samples\TestMdi5.prg and click on the GET from another MDICHILD window. It works fine.
Posted: Thu Oct 18, 2007 2:29 pm
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
Posted: Thu Oct 18, 2007 4:17 pm
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
Posted: Thu Oct 18, 2007 5:26 pm
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
Posted: Fri Oct 19, 2007 10:58 am
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
Posted: Fri Oct 19, 2007 1:15 pm
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() } ) }
Posted: Fri Oct 19, 2007 4:33 pm
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
Posted: Mon Oct 22, 2007 4:42 pm
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
Posted: Tue Oct 23, 2007 9:47 am
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
Posted: Tue Oct 23, 2007 9:55 am
by Antonio Linares
bOldGotFocus = oControl:bGotFocus
oControl:bGotFocus = { || Eval( bOldGotFocus ), ... new code ... }
Posted: Tue Oct 23, 2007 2:55 pm
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
Posted: Wed Oct 24, 2007 9:46 am
by AHF
I need help on the problem found in my previous message ?
Regards
Antonio
Posted: Fri Oct 26, 2007 11:39 am
by AHF
Antonio
Do you have any idea on solving the previous problem.
Thanks,
Antonio
Posted: Mon Nov 05, 2007 11:02 am
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