Window close

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

Window close

Post by pawelu »

Antonio,

This is simple two window app code. When button '>>' in main window is pressed next window is create, but when press 'OK' button in next window, which will close window, next window stay visible. Second press 'OK' button destroy window. Use 'OK' button in right upper window corner move window in background mode.

Regards
Pawel

Code: Select all

#Include 'FwCe.Ch'

Function TestClose ()

   Local oWnd := Nil

   Define Window oWnd Title 'Test Close'
   @ 100,  10 Say 'This is main window' Size 150, 15 Pixel
   @ 200, 178 Button '>>' Size 60, 20 Pixel Action IIf (NextWindow (), Nil, oWnd : End ())
   Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)

Return .T.

Function NextWindow ()

   Local oWnd := Nil
   Local lRet := .F.

   Define Window oWnd Title 'Next Window'
   @ 100,  10 Say 'This is next window' Size 150, 15 Pixel
   @ 200, 178 Button 'OK' Size 60, 20 Pixel Action (lRet := .T., oWnd : End ())
   Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Pawel,

The button in the second window is somehow firing again the main window button action. It can be checked doing this:

Code: Select all

   @ 200, 178 Button oBtn PROMPT '>>' Size 60, 20 Pixel ;
      Action ( oBtn:bAction := nil, NextWindow() )
We are searching what may be the reason for this curious behavior. Thanks.
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,

Fixed. It was a bug in Class TButton. Please download FWPPC again.

Thanks for your feedback,
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply