MDIchild window Focus diferent behavior as FW16

MDIchild window Focus diferent behavior as FW16

Postby AHF » Wed Oct 17, 2007 4: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » Wed Oct 17, 2007 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Thu Oct 18, 2007 2: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby James Bott » Thu Oct 18, 2007 4: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Thu Oct 18, 2007 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Postby Antonio Linares » Fri Oct 19, 2007 1: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Fri Oct 19, 2007 4: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby AHF » Mon Oct 22, 2007 4: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Tue Oct 23, 2007 9: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Antonio Linares » Tue Oct 23, 2007 9:55 am

bOldGotFocus = oControl:bGotFocus

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby AHF » Tue Oct 23, 2007 2: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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Wed Oct 24, 2007 9:46 am

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

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

Postby AHF » Fri Oct 26, 2007 11:39 am

Antonio

Do you have any idea on solving the previous problem.

Thanks,

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

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests

cron