FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Advice needed
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Advice needed
Posted: Tue Jun 23, 2009 01:28 PM

Hi,

I'm trying to create a MDI window, that can open multiple MDI Child windows that each browse the same database (each window opens a new instance of the database and gives it a unique alias) I have tried to create my own class, and i call a :new() to open the windows/databases/browse etc.

I am now adding a menu to the MDI window, but have the problem of knowing what window is highlighted and to which object the window refers to.

My class stores the alias name of the browse and i was hoping to reference this in the action of the menu (oObject:cAlias->TICKET_NBR) but i don't know how to reference the Object that is selected.

Any help will be appreciated

Pete

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Advice needed
Posted: Tue Jun 23, 2009 04:38 PM

oWnd:getActive() returns the active MDI child window (where oWnd is the main window).

If you use database objects then you don't need to deal with aliases.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Advice needed
Posted: Wed Jun 24, 2009 08:11 AM

I get the following error when i try to referene oWnd:GetActive()

Error description: Warning BASE/1004 Message not found: TMDIFRAME:GETACTIVE - Please contact P & L
Args:

Stack Calls

Called from: C:\xHarbour\source\rtl\tobject.prg => TMDIFRAME:ERROR(172)
Called from: C:\xHarbour\source\rtl\tobject.prg => TMDIFRAME:MSGNOTFOUND(205)
Called from: C:\xHarbour\source\rtl\tobject.prg => TMDIFRAME:GETACTIVE(0)
Called from: Scedmdi.prg => (b)SCHEDMDICHILDMENU(205)
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(437)
Called from: C:\FWH\source\classes\window.prg => TWINDOW:COMMAND(1003)
Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:COMMAND(241)
Called from: => TMDIFRAME:HANDLEEVENT(0)
Called from: C:\FWH\source\classes\window.prg => _FWH(3333)
Called from: => WINRUN(0)
Called from: C:\FWH\source\classes\window.prg => TWINDOW:ACTIVATE(952)
Called from: ORD_MOD.PRG => MAIN(516)

Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Advice needed
Posted: Wed Jun 24, 2009 08:23 AM

I've solved my problem - i just pass Self to the menu function and i can then reference the aliases of the databases used. It was pretty obvious really, it's amazing what happens after you've had some sleep!!!

Pete

Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: Advice needed
Posted: Wed Jun 24, 2009 11:09 AM

or WndMain():oWndClient:getActive()

Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Advice needed
Posted: Thu Jun 25, 2009 09:48 AM

Another question,

When a child closes, i would like the wondow to automatically retile the remaining child windows. I've tried to call :tile(.T.) on the valid of the child window, but i think that the app thinks the window is still open. Does anyone know how i can achieve this?

Regards,

Pete

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Advice needed
Posted: Thu Jun 25, 2009 04:31 PM

>I've tried to call :tile(.T.) on the valid of the child window, but i think that the app thinks the window is still open.

When the valid is called, the window IS still open--the window only closes after the valid is executed.

You can try using a timer in the valid so it tiles after the window is closed.

These issues are why I never use MDI windows. There is way too much effort for the user spent manipulating windows. A SDI interface like Outlook is much easier for the user.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Advice needed
Posted: Mon Jun 29, 2009 11:07 AM

Thanks James, the timer did the trick :)

Pete

Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Advice needed
Posted: Mon Jun 29, 2009 02:49 PM

Next question...

If I have 3 tiled MDICHILD windows opened and i want to resort the order that they appear by dragging the bottom window above the second window, is there a way to call a tile when the mouse button is released? I've tried the bMoved option but, this is called as soon as the window is moved not when the mouse button is released.

Any ideas?

Thanks

Pete

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Advice needed
Posted: Mon Jun 29, 2009 03:01 PM

Try bLButtonUp.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion