Why the MAIN Window always behind the CHILD Windows?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

bootwan
Posts: 52
Joined: Thu May 27, 2010 2:33 am

Why the MAIN Window always behind the CHILD Windows?

Post by bootwan »

.
Last edited by bootwan on Sat Jun 26, 2010 3:53 pm, edited 1 time in total.
bootwan
Posts: 52
Joined: Thu May 27, 2010 2:33 am

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

Post by bootwan »

.
Last edited by bootwan on Sat Jun 26, 2010 3:53 pm, edited 1 time in total.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

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

Post 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)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
bootwan
Posts: 52
Joined: Thu May 27, 2010 2:33 am

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

Post by bootwan »

.
Last edited by bootwan on Sat Jun 26, 2010 3:52 pm, edited 1 time in total.
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

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

Post 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-)
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

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

Post by Rathinagiri »

Thanks for the info Grigory. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
bootwan
Posts: 52
Joined: Thu May 27, 2010 2:33 am

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

Post by bootwan »

.
Last edited by bootwan on Sat Jun 26, 2010 3:52 pm, edited 1 time in total.
bootwan
Posts: 52
Joined: Thu May 27, 2010 2:33 am

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

Post by bootwan »

.
Last edited by bootwan on Sat Jun 26, 2010 3:51 pm, edited 1 time in total.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

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

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

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

Post 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 ;)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply