Advice needed

Advice needed

Postby PeterHarmes » Tue Jun 23, 2009 1: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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Advice needed

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

Re: Advice needed

Postby PeterHarmes » Wed Jun 24, 2009 8: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)
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Advice needed

Postby PeterHarmes » Wed Jun 24, 2009 8: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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Advice needed

Postby frose » 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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Advice needed

Postby PeterHarmes » Thu Jun 25, 2009 9: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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Advice needed

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

Re: Advice needed

Postby PeterHarmes » Mon Jun 29, 2009 11:07 am

Thanks James, the timer did the trick :)

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Advice needed

Postby PeterHarmes » Mon Jun 29, 2009 2: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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Advice needed

Postby James Bott » Mon Jun 29, 2009 3:01 pm

Try bLButtonUp.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 115 guests