Window close

Window close

Postby pawelu » Mon Mar 13, 2006 7:45 am

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  Expand view  RUN
#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
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Mon Mar 13, 2006 9:32 am

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  Expand view  RUN
   @ 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: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Mar 13, 2006 10:16 am

Pawel,

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

Thanks for your feedback,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
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 6 guests