Page 1 of 2

Why the MAIN Window always behind the CHILD Windows?

Posted: Thu May 27, 2010 12:49 pm
by bootwan
.

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 3:21 am
by bootwan
.

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 3:30 am
by Rathinagiri
IMHO it is not only the property of HMG but also the property of Win32, or even GTK. Please try GIMP. Or open MS-Excel. Press Ctrl+F (search window). The search window is a child window, which will always be in front of the main window! So, the main window will be behind a child window.

In GUI applications, main window is a background window and all operations are handled through either child windows or modal windows. If you want to handle both main and child windows at a time, it has to be designed such that, there will be space for both the windows. (Like HMG-IDE)

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 4:52 am
by bootwan
.

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 7:06 am
by gfilatov
bootwan wrote:There is no one reply. I show the pictures to explain it.
The following application has a MAIN window "Program Main Menu" with TREE control in it for user to choosing program item.
If we open CHILD forms (Customers, Suppliers and Employees), we can see the whole form by click the title of form.
But it will not show the whole form when we click the MAIN window "Program Main Menu"
Hi,

Try to use WINDOWTYPE STANDARD instead of WINDOWTYPE CHILD for child windows :idea:

Hope that helps 8-)

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 7:36 am
by Rathinagiri
Thanks for the info Grigory. :)

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 7:43 am
by bootwan
.

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 11:23 am
by bootwan
.

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 12:13 pm
by Rathinagiri
You can't call C functions like this. We have to pass the necessary variables to the C functions via 'HB_FUNC'.

Consider your code:

Code: Select all

STATIC FUNCTION ShowInTaskBar(cFormName, lVisible)
LOCAL hWnd, nStyle
   hWnd   := GetFormHandle(cFormName)
   if lVisible
      HBSetWindowLong(hWnd,1)
   else
      HBSetWindowLong(hWnd,0)
   endif
RETURN NIL 

#pragma BEGINDUMP

#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"
#include <wingdi.h>

HB_FUNC ( HBSETWINDOWLONG  )
{
   HWND hWnd1;
   hWnd1 = (HWND) hb_parnl (1);
   if (hb_parni(2) = 1)
   {
      SetWindowLong( hWnd1, GWL_EXSTYLE, HB_BITOR( GetWindowLong(hWnd1, GWL_EXSTYLE), WS_EX_APPWINDOW ) ); 
   }
   else
   {
      SetWindowLong( hWnd1, GWL_EXSTYLE, HB_BITAND( GetWindowLong(hWnd1, GWL_EXSTYLE), HB_BITNOT(WS_EX_APPWINDOW) ) ) ;
   }
}

#pragma ENDDUMP
And, hb_bitor, hb_bitand,hb_bitnot can not be used inside C Code. We have to find some equivalent functions in C.

Re: Why the MAIN Window always behind the CHILD Windows?

Posted: Wed Jun 02, 2010 1:06 pm
by Roberto Lopez
bootwan wrote:Great! Great!

It appears as what I wanted.

Thanks to gfilatov.

Another question is how to hide the standard forms from TaskBar?
Cause HMG has no the property "ShowInTaskbar".
Child windows does not appear on taskbar ;)