Empty menu

pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Empty menu

Post by pawelu »

Hello,

It is possible create window with empty menu ?

Regards
Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Do you mean a menu with no menuitems ?

If so, whats its purpouse ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

This window is dialog. I found in eVc BasicDialog sample. Dialog is paint on full screen and have empty menu. This dialog looks very well. Right corner show Ok buttton vs standard X button.
Dialog on init use SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN and SHCMBF_HIDESIPBUTTON | SHCMBF_EMPTYBAR define but I don't know how send this message to init dialog procedure.

Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Try this:

Code: Select all

ACTIVATE DIALOG oDlg ... ON INIT SetWindowLong( oDlg:hWnd, GWL_EXSTYLE, nOr( GetWindowLong( oDlg:hWnd, GWL_EXSTYLE ), SHIDIF_DONEBUTTON,  SHIDIF_SIZEDLGFULLSCREEN, SHCMBF_HIDESIPBUTTON, CMBF_EMPTYBAR ) )
Please let us know if it works ok.
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

I try and try ... and nothing to change dialog. Maybe my code is wrong ?
When I use GWL_EXSTYLE GetWindowLong () return 0, GWL_STYLE return value <> 0 but dialog is still standard.

Code: Select all

#define GWL_STYLE                   (-16)
#define GWL_EXSTYLE                 (-20)
#define SHIDIM_FLAGS                1 // 0x0001
#define SHIDIF_DONEBUTTON           1 // 0x0001
#define SHIDIF_SIZEDLG              2 // 0x0002
#define SHIDIF_SIZEDLGFULLSCREEN    4 // 0x0004
#define SHIDIF_SIPDOWN              8 // 0x0008

Function TestDialog ()

Local cGet := Space (50)

Define Dialog oDlg Resource 'BasicDialog'
ReDefine Get cGet Id 1 Of oDlg
ReDefine Button Id 2 Of oDlg Action oDlg : End ()
Activate Dialog oDlg On Init ;
SetWindowLong (oDlg : hWnd, GWL_STYLE, ;
nOr (GetWindowLong (oDlg : hWnd, GWL_STYLE), ;
SHIDIF_DONEBUTTON, SHIDIF_SIZEDLGFULLSCREEN))

Return .T.

// rc.file
BASICDIALOG DIALOG DISCARDABLE 0, 0, 160, 168
STYLE WS_POPUP|WS_VISIBLE
FONT 8, "Tahoma"
BEGIN
    CONTROL "", 1, "Edit", ES_MULTILINE|WS_BORDER|WS_TABSTOP, 32, 4, 124, 20
    CONTROL "OK", 2, "Button", WS_TABSTOP, 116, 148, 40, 12
END
Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Try to use those defines in the RC file:

STYLE WS_POPUP | WS_VISIBLE | SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN

...

Tested it here. It does not work.

We may search on google for a C sample that uses SHIDIF_DONEBUTTON
regards, saludos

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

Post by Antonio Linares »

regards, saludos

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

Post by Antonio Linares »

Pawel,

Its working :)

Code: Select all

   ACTIVATE DIALOG oDlg CENTERED ;
     ON INIT SetOKButton( oDlg:hWnd )
   
return nil   

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>

HB_FUNC( SETOKBUTTON )
{
   SHINITDLGINFO shidi;

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = ( HWND ) hb_parnl( 1 );
   shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN;

   SHInitDialog( &shidi );
}   

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

thanks so much

Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Still we need to know what command generates the click of the OK at the right top corner.
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

I found this in BasicDialog sample:

Code: Select all

    case WM_COMMAND:
        // Dialog manager produces IDOK when the done button is tapped
        if ((IDOK == LOWORD(wParam)) || (IDCANCEL == LOWORD(wParam)))
        {
            EndDialog(hDlg, LOWORD(wParam));
            return TRUE;
        }
        break;
Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Its a little more complex than that, but we already got it working :)

There is a new FWPPC build ready to be downloaded. Please review samples\okbutton.prg working sample to see how to use it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Post by pawelu »

Antonio,

I modify SetOkButton with this (empty menu bar):

Code: Select all

#pragma BEGINDUMP 

#include <hbapi.h> 
#include <windows.h> 
#include <aygshell.h> 

HB_FUNC (SETOKBUTTON) 

{ 
   
   HWND hDlg = (HWND) hb_parnl (1);

   SHINITDLGINFO shidi; 

   shidi.dwMask  = SHIDIM_FLAGS; 
   shidi.hDlg    = hDlg;
   shidi.dwFlags = SHIDIF_DONEBUTTON|SHIDIF_SIZEDLGFULLSCREEN; 

   SHInitDialog (&shidi); 

   SHMENUBARINFO mbi;

   memset(&mbi, 0, sizeof (SHMENUBARINFO));
   mbi.cbSize = sizeof (SHMENUBARINFO);
   mbi.hwndParent = hDlg;
   // mbi.hInstRes = g_hInst; // ???
   mbi.dwFlags = SHCMBF_EMPTYBAR; 
   SHCreateMenuBar (&mbi);

}    

#pragma ENDDUMP
Dialog is now perfect.

Best regards
Pawel
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

Very good :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
GWard
Posts: 31
Joined: Thu Oct 13, 2005 10:18 am
Location: UK

Post by GWard »

Antonio Linares wrote:Pawel,

Its a little more complex than that, but we already got it working :)

There is a new FWPPC build ready to be downloaded. Please review samples\okbutton.prg working sample to see how to use it.
Antonio,

How can I get the OK button to close the current WINDOW when using nested windows.

The code in samples\okbutton.prg changes the "X" to an "OK" but nothing happens when I click the "OK"

I am using

Code: Select all

ACTIVATE WINDOW oWnd ON INIT SetOkButton(oWnd:hWnd)
Post Reply