Dialog with menu

Dialog with menu

Postby pawelu » Sun Mar 04, 2007 10:21 am

Antonio,

I'm trying to create fullscreen dialog with menu. When menu is set to dialog window, push button in dialog doesn't work. Buttons in dialog without menu works ok. What is wrong in my code ?

Thanks
Pawel

Code: Select all  Expand view  RUN
// prg file
#Include 'FwCe.Ch'

Function TestDlgm1 ()

   Local oDlg := Nil
   Local oMnu := Nil

   Define Menu oMnu Resource 3001
   ReDefine MenuItem Id 3011 Of oMnu Action oDlg : End ()

   Define Dialog oDlg Resource 'NALLIST'
   ReDefine Button Id 1009 Of oDlg Action MsgInfo ('1009')
   ReDefine Button Id 1010 Of oDlg Action MsgInfo ('1010')
   ReDefine Button Id 1011 Of oDlg Action MsgInfo ('1011')
   ReDefine Button Id 1012 Of oDlg Action MsgInfo ('1012')
   Activate Dialog oDlg On Init (DlgFullScr (oDlg : hWnd), oDlg : SetMenu (oMnu))
   // Activate Dialog oDlg On Init DlgFullScr (oDlg : hWnd)

Return .T.

#pragma BEGINDUMP

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

HB_FUNC (DLGFULLSCR)
{
   SHINITDLGINFO shidi;
   HWND hDlg = (HWND) hb_parnl (1);

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = hDlg;
   shidi.dwFlags = SHIDIF_EMPTYMENU|SHIDIF_SIZEDLGFULLSCREEN;
   SHInitDialog (&shidi);
}

#pragma ENDDUMP

// rc.file
#include <windows.h>
#include <commctrl.h>

LANGUAGE LANG_POLISH,SUBLANG_DEFAULT

NALLIST DIALOG DISCARDABLE 0, 0, 136, 154
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "Naleznosci"
FONT 10, "System"
BEGIN
  CONTROL "Klient:", 1001, "Static", SS_RIGHT|WS_GROUP, 0, 2, 22, 11
  CONTROL "Klient:", 1002, "Static", SS_RIGHT|WS_GROUP, 0, 116, 22, 11
  CONTROL "Data:", 1003, "Static", SS_RIGHT|WS_GROUP, 0, 128, 22, 11
  CONTROL "Zaplac:", 1004, "Static", SS_RIGHT|WS_GROUP, 64, 128, 30, 11
  CONTROL "Term:", 1005, "Static", SS_RIGHT|WS_GROUP, 0, 140, 22, 11
  CONTROL "Do zapl:", 1006, "Static", SS_RIGHT|WS_GROUP, 64, 140, 30, 11
  CONTROL "", 1007, "ComboBox", WS_BORDER|CBS_DROPDOWNLIST|WS_VSCROLL|WS_TABSTOP, 22, 2, 112, 100
  // CONTROL "", 1008, "TWBrowse", WS_TABSTOP|0x00b00000, 0, 15, 136, 88
  CONTROL "Edycja", 1009, "Button", WS_TABSTOP, 0, 104, 32, 11
  CONTROL "KP", 1010, "Button", WS_TABSTOP, 34, 104, 34, 11
  CONTROL "KW", 1011, "Button", WS_TABSTOP, 70, 104, 32, 11
  CONTROL "Saldo", 1012, "Button", WS_TABSTOP, 104, 104, 32, 11
  CONTROL "", 1013, "Edit", ES_AUTOHSCROLL|ES_UPPERCASE|ES_READONLY|WS_BORDER, 22, 116, 112, 11
  CONTROL "", 1014, "Edit", ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 22, 128, 42, 11
  CONTROL "", 1015, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 94, 128, 40, 11
  CONTROL "", 1016, "Edit", ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 22, 140, 42, 11
  CONTROL "", 1017, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 94, 140, 40, 11
END

3001 RCDATA
BEGIN
  3001, 1
  (-2), 30001, 4, 24, 30001, 0, 0
END

3001 MENU
BEGIN
  POPUP "Plik"
  BEGIN
    MENUITEM "Zamknij", 3011
  END
END

STRINGTABLE
BEGIN
  30001, "Plik"
END
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Sun Mar 04, 2007 7:41 pm

Pawel,

This change is required in source\classes\dialog.prg Method Command:

case nNotifyCode == 0 .and. ::oMenu != nil .and. oWndFromHwnd( hWndCtl ) == nil
regards, saludos

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


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 56 guests