Window, dialog and focus

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

Window, dialog and focus

Post by pawelu »

Antonio,

I create sample window and dialog code. When standard resource dialog is show and user click in window over dialog area, dialog is hide background. I test this dialog in previous version FWPPC (before 2006.02.24 build) and when dialog is shows, active area is only dialog area.

Regards
Pawel

Code: Select all


// testfocs.prg
#Include 'FwCe.Ch'

Function TestFocus ()

   Local oWnd := Nil

   Set Date German

   Define Window oWnd Title 'Test Focus'
   @ 200, 178 Button 'OK' Size 60, 20 Pixel Action IIf (DialogSample (), Nil, oWnd : End ())
   // click in window over dialog area
   Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)

Return .T.

Function DialogSample ()

   Local oDlg := Nil
   Local dDate := Date ()
   Local cTime := Left (Time (), 5)
   Local lRet := .F.

   Define Dialog oDlg Resource 'DateTime'
   ReDefine Get dDate Id 1003 Of oDlg Picture '@D' ReadOnly
   ReDefine Get cTime Id 1004 Of oDlg ReadOnly
   ReDefine Button Id 1005 Of oDlg Action (lRet := .T., oDlg : End ())
   ReDefine Button Id 1006 Of oDlg Action (lRet := .F., oDlg : End ())
   Activate Dialog oDlg Centered

Return lRet

#pragma BEGINDUMP

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

HB_FUNC (EMPTYMENU)
{
   SHINITDLGINFO shidi;
   HWND hWnd = (HWND) hb_parnl (1);
   SHMENUBARINFO mbi;

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = hWnd;
   shidi.dwFlags = SHIDIF_DONEBUTTON;
   SHInitDialog (&shidi);

   memset(&mbi, 0, sizeof (SHMENUBARINFO));
   mbi.cbSize = sizeof (SHMENUBARINFO);
   mbi.hwndParent = hWnd;
   mbi.dwFlags = SHCMBF_EMPTYBAR;
   SHCreateMenuBar (&mbi);

}

#pragma ENDDUMP

// testfocs.rc
#include "c:\vce\include\arm\windows.h"
#include "c:\vce\include\arm\commctrl.h"

DateTime DIALOG DISCARDABLE 0, 0, 126, 54
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "Date, time"
FONT 8, "MS Shell Dlg"
BEGIN
  CONTROL "System date:", 1001, "Static", SS_RIGHT|WS_GROUP, 2, 8, 60, 12
  CONTROL "System time:", 1002, "Static", SS_RIGHT|WS_GROUP, 2, 21, 60, 12
  CONTROL "", 1003, "Edit", ES_READONLY|WS_BORDER|WS_TABSTOP, 64, 8, 50, 12
  CONTROL "", 1004, "Edit", ES_READONLY|WS_BORDER|WS_TABSTOP, 64, 21, 50, 12
  CONTROL "OK", 1005, "Button", WS_TABSTOP, 56, 38, 32, 12
  CONTROL "Cancel", 1006, "Button", WS_TABSTOP, 90, 38, 32, 12
END 

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

Post by Antonio Linares »

Pawel,

You may use the DIALOG clause OF :

DEFINE DIALOG oDlg ... OF oWnd
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply