Menu actions

Menu actions

Postby pawelu » Mon Oct 30, 2006 4:40 am

Antonio,

When I call window with menu program don't stop execution after activate clause. Below is sample.

Regards
Pawel

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

Function TestMenu ()

   Local oWnd := Nil
   Local oMnu := Nil

   Define Menu oMnu Resource 1001
   ReDefine MenuItem Id 1011 Of oMnu Action oWnd : End ()
   ReDefine MenuItem Id 1021 Of oMnu Action Window1 ()
   ReDefine MenuItem Id 1022 Of oMnu Action Window2 ()

   Define Window oWnd Title 'Test menu' Menu oMnu
   Activate Window oWnd

Return .T.

Function Window1 ()

   Local oWnd := Nil
   Local oGrp := Nil
   Local nGrp := 1

   Define Window oWnd Title 'Window1'

   @   5,   5 Group oGrp To 219, 230 Prompt 'Wybierz czynność do wykonania' Pixel
   @   1,   2 Radio nGrp Items 'Archiwizacja danych', 'Weryfikacja tabel', ;
   'Reindeksacja tabel', 'Usunięcie tabel', 'Ograniczenie danych', ;
   'Pobranie nowej wersji', 'Lista parametrów' Of oGrp Size 150, 15
   @ 246, 116 Button 'OK' Pixel Size 60, 20 Action oWnd : End ()
   @ 246, 178 Button 'Anuluj' Pixel Size 60, 20 Action oWnd : End ()

   Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)

   MsgInfo ('Action after activate window')

Return .T.

Function Window2 ()

   Local oWnd := Nil
   Local oGrp := Nil
   Local nGrp := 1

   Define Window oWnd Title 'Window2'

   @   5,   5 Group oGrp To 175, 230 Prompt 'Wybierz dane konfiguracyjne' Pixel
   @   1,   2 Radio nGrp Items 'użytkownik', 'o firmie', 'uprawnienia', 'lista magazynów', 'adresy serwerów' Of oGrp Size 160, 15
   @ 246, 116 Button 'OK' Pixel Size 60, 20 Action Nil
   @ 246, 178 Button 'Anuluj' Pixel Size 60, 20 Action oWnd : End ()

   Activate Window oWnd On Init EmptyMenu (oWnd : hWnd)

   MsgInfo ('Action after activate window')

Return .T.

#pragma BEGINDUMP

#include <hbapi.h>
#include <hbapirdd.h>

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

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

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

#pragma ENDDUMP

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

LANGUAGE LANG_POLISH,SUBLANG_DEFAULT

1001 RCDATA
BEGIN
  1001, 2
  (-2), 10001, 4, 24, 10001, 0, 0
  (-2), 10002, 4, 24, 10002, 0, 1
END

1001 MENU
BEGIN
  POPUP "File"
  BEGIN
    MENUITEM "Exit", 1011
  END
  POPUP "Test"
  BEGIN
    MENUITEM "Window2", 1022
    MENUITEM "Window1", 1021
  END
END

STRINGTABLE
BEGIN
  10001, "File"
  10002, "Test"
END
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Re: Menu actions

Postby Enrico Maria Giordano » Mon Oct 30, 2006 7:58 am

It's normal behavior. Just don't put anything after the inner ACTIVATE WINDOW command. Use VALID clause instead.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby pawelu » Mon Oct 30, 2006 8:15 am

Enrico,

Yes, but when I'm use previous version of FWPPC, commands after activate window clause were run after window close. In this moment probably I must change program code.

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

Postby pawelu » Mon Oct 30, 2006 8:32 am

Enrico,

Some samples: in first procedure message is show after window closed, in seconds before ... What is properly - my opinion after.

Regards
Pawel

Code: Select all  Expand view
Function TestWnd ()

   Local oWnd := Nil

   Define Window oWnd Title 'Test Window'

   @ 100, 100 Button 'Window2' Size 60, 20 Pixel Action Wnd2 ()

   Activate Window oWnd

   // this is evaluated after window closed
   MsgInfo ('Commands after window activate')

Return .T.

Function Wnd2 ()

   Local oWnd := Nil

   Define Window oWnd Title 'Window 2'
   Activate Window oWnd

   // this is eveluated before window closed
   MsgInfo ('Commands after window activate')

Return .T.
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Enrico Maria Giordano » Mon Oct 30, 2006 9:14 am

This is expected, as far as I know.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby pawelu » Mon Oct 30, 2006 9:19 am

Enrico,

Other test - comma list: after button press all three window is created and focus is for Window 3 (?).

Pawel

Code: Select all  Expand view
Function TestWnd ()

   Local oWnd := Nil
   Local i := 0

   Define Window oWnd Title 'Test Window'

   @ 100, 100 Button 'Window2' Size 60, 20 Pixel Action (Wnd1 (++ i), Wnd1 (++ i), Wnd1 (++ i))

   Activate Window oWnd

Return .T.

Function Wnd1 (i)

   Local oWnd := Nil

   Define Window oWnd Title 'Window ' + AllTrim (Str (i))
   Activate Window oWnd

Return .T.
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Mon Oct 30, 2006 10:14 am

Pawel,

We have modified previous FWPPC behavior to turn it FW compatible.

Only the first ACTIVATE WINDOW waits in a modal way. Next ACTIVATE WINDOW just show it but don't wait.
regards, saludos

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

Postby pawelu » Mon Oct 30, 2006 10:51 am

Antonio,

This mean that I can't use commands eg:

(BuildAndWaitWithWindow1(), DoOtherCommandsAfterWindow1Close ())

Thanks for reply
Pawel
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Enrico Maria Giordano » Mon Oct 30, 2006 10:52 am

No, just use VALID clause, as I already said.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Pier Luigi » Mon Oct 30, 2006 10:57 am

Enrico,

using VALID clause work fine.

Pier Luigi
User avatar
Pier Luigi
 
Posts: 58
Joined: Fri Oct 07, 2005 6:30 am
Location: Rome - Italy

Postby pawelu » Mon Oct 30, 2006 11:00 am

Enrico,

What would be in Valid clause for my test code ?

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

Postby Enrico Maria Giordano » Mon Oct 30, 2006 11:04 am

Code: Select all  Expand view
ACTIVATE WINDOW oWnd
         VALID MYCLOSEFUNCTION()

STATIC FUNCTION MYCLOSEFUNCTION()

    // Do what you want

    RETURN .T.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby pawelu » Mon Oct 30, 2006 11:10 am

Enrico,

What this change in this code:

Code: Select all  Expand view
Function Window1 ()

   Local oWnd := Nil

   Define Window oWnd Title 'Window 1'
   @ 100, 100 Button 'Window 2' Size 80, 20 Pixel Action (Wnd2 (), MsgBox ('Ok'))
   Activate Window oWnd

Return .T.

Function Wnd2 ()

   Define Window oWnd Title 'Window 2'
   @ 100, 100 Button 'Close' Size 80, 20 Pixel Action oWnd : End ()
   // oWnd : bValid := {|| ???}
   Activate Window oWnd

Return .T.
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Mon Oct 30, 2006 11:23 am

Pawel,
Code: Select all  Expand view

Function Window1 ()

   Local oWnd := Nil

   Define Window oWnd Title 'Window 1'
   @ 100, 100 Button 'Window 2' Size 80, 20 Pixel Action Wnd2()
   Activate Window oWnd

Return .T.

Function Wnd2 ()

   Define Window oWnd Title 'Window 2'
   @ 100, 100 Button 'Close' Size 80, 20 Pixel Action oWnd : End ()
   Activate Window oWnd ;
      VALID ( MsgBox( "Ok" ), .t. )

Return .T.
regards, saludos

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

Postby pawelu » Mon Oct 30, 2006 11:26 am

Antonio,

Thanks for help.

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

Next

Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 8 guests