TO ANTONIO : Using menu on the dialog RESOLVED!!

User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

TO ANTONIO : Using menu on the dialog RESOLVED!!

Post by Silvio »

I use menu on the dialog
I must have also the variables lsave to save or not a record

function EditClient( oLbx, lAppend )

local oDlg, oFld,oFont, oFont1
Local lSave :=.f.

... DEFINE DIALOG oDlg TITLE If( lAppend, "New", "Update" )

ACTIVATE DIALOG oDlg ;
ON INIT ( DlgFullScreen( oDlg:hWnd ), oDlg:SetMenu( DialogButtons(oDlg) ) )

IF lSave =.t.
? "I'here"
ELSE
? "I'm not here"
ENDIF



function DialogButtons(oDlg)
local oMenu
DEFINE MENU oMenu RESOURCE 102 ;
BITMAPS 10 ; // bitmap resources ID
IMAGES 2 // number of images in the bitmap
REDEFINE MENUITEM ID 110 OF oMenu ACTION ( lSave:=.T.,oDlg:End())
REDEFINE MENUITEM ID 120 OF oMenu ACTION ( lSave:=.f.,oDlg:End())
return oMenu



IF I insert Lsave on DialogButtons(oDlg) How I can to return this value ?
Last edited by Silvio on Tue May 12, 2009 11:59 am, edited 1 time in total.
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog

Post by Otto »

Silvio,
have you tried to use a STATIC variable?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

Otto,
I cannot make a static variable if this variable is ONLY for a dialog (edit client)
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog

Post by Otto »

Silvio,
why not?
I do it always this way.

Code: Select all


STATIC lSave := .f.

function main
return


function EditClient( oLbx, lAppend )

local oDlg, oFld,oFont, oFont1
//Local lSave :=.f.

... DEFINE DIALOG oDlg TITLE If( lAppend, "New", "Update" )

ACTIVATE DIALOG oDlg ;
ON INIT ( DlgFullScreen( oDlg:hWnd ), oDlg:SetMenu( DialogButtons(oDlg) ) )

IF lSave =.t.
? "I'here"
ELSE
? "I'm not here"
ENDIF



function DialogButtons(oDlg)
local oMenu
DEFINE MENU oMenu RESOURCE 102 ;
BITMAPS 10 ; // bitmap resources ID
IMAGES 2 // number of images in the bitmap
REDEFINE MENUITEM ID 110 OF oMenu ACTION ( lSave:=.T.,oDlg:End())
REDEFINE MENUITEM ID 120 OF oMenu ACTION ( lSave:=.f.,oDlg:End())
return oMenu

 


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

I made it

Static lsave:=.f.
and on editclient function

ACTIVATE DIALOG oDlg ;
ON INIT ( DlgFullScreen( oDlg:hWnd ), oDlg:SetMenu( DialogButtons(oDlg) ) )
HideKeyboard()
If lsave =.t.
?"ciao"
endif

return nil
function DialogButtons(oDlg)

local oMenu

DEFINE MENU oMenu RESOURCE 102 ;
BITMAPS 10 ; // bitmap resources ID
IMAGES 2 // number of images in the bitmap

REDEFINE MENUITEM ID 110 OF oMenu ACTION (lsave:=.t., MsgInfo( "Nuovo inserimento" ), oDlg:end())
REDEFINE MENUITEM ID 120 OF oMenu ACTION (lsave:=.f.,MsgInfo( "Annulla operazione" ),oDlg:end() )

eturn oMenu




but when I click on OK i
IT CLOSE the dialog
and not show me the message "CIAO"
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog

Post by Otto »

Silvio,
please post the rc file, too.
Regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

use manubmp.rc on sample fwppc folder please
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog

Post by Otto »

Hello Silvio,

I copied together all your posts but if I compile your code the menu is missing.

Please check where the differences to your original code are.

Having a working self contained example I think we can start looking how to resolve the problems.

Best regards,
Otto

dbf-file
http://www.atzwanger-software.com/fw/silvio.zip

prg-file

Code: Select all

#include "FWCE.ch"


#Define EVENT_SIP 224

REQUEST DBFCDX

Static lsave:=.f.

FUNCTION Main()

local oDlgClient , oTabs
local oLbx
local cVar
local aHBitMaps:=Array( 5 )
local n


aHBitMaps:= { ReadBitmap( 0, CurDir() +"Level1.bmp" ), ; // BitMaps de 14 x 32
ReadBitmap( 0, CurDir() +"\Level2.bmp" ), ;
ReadBitmap( 0, CurDir() +"\Level3.bmp" ), ;
ReadBitmap( 0, CurDir() +"\Level4.bmp" ),;
ReadBitmap( 0, CurDir() +"\Level5.bmp" ) }

USE ( CurDir() + "\Clientes" ) VIA "DBFCDX"


if RecCount() == 0
APPEND BLANK
endif

if ! File( CurDir() + "\CliName.CDX" )
INDEX ON Clientes->Nombre TO ( CurDir() + "\CliName" )
endif

Clientes->(DbSetIndex( CurDir() + "\CliName" ))

Clientes->( OrdSetFocus( "\CliName" ) )
Clientes->( DbGoTop() )


DEFINE DIALOG oDlgClient TITLE "Kunden"

@ 0, 0 LISTBOX oLbx FIELDS aHBitmaps[ Max( 1, Clientes->Nivel ) ],;
Clientes->Nombre,;
Clientes->Telefono,;
Str( Clientes->Edad, 3 ) ;
HEADERS "L", "Cognome e nome", "Telefono", "Ombrellone" ;
FIELDSIZES 16, 95, 80, 8 ;
SIZE 105, 135 OF oDlgClient



oLbx:nClrPane := { || If( OrdKeyNo() % 2 == 0, RGB( 230, 230, 230), RGB( 190, 215, 190 ) ) }

oLbx:nClrForeHead:=CLR_BLUE

*oLbx::bKeyDown :={|nKey| Val_nKey(nKey,oDlg)}

oDlgClient:bSettingChange := {|uVal|PocketEvent( uVal,oDlgClient,olbx ) }

ACTIVATE DIALOG oDlgClient;
ON INIT ( SetOKButton( oDlgClient:hWnd ),;
DlgFullScreen( oDlgClient:hWnd ), ;
oDlgClient:SetMenu( DialogBar(oDlgClient,oLbx) ) )



AEval( aHBitmaps, { | hBmp | DeleteObject( hBmp ) } )
Clientes->(DbCloseArea())
RETU NIL



function EditClient( oLbx, lAppend )

local oDlg, oFld,oFont, oFont1

lFivePro = "F" $ Clientes->Productos
lDialog = "D" $ Clientes->Productos
lObjects = "O" $ Clientes->Productos
nNivel = max( 1, Clientes->Nivel )

cName = Clientes->Nombre
cAddress = Clientes->Direccion
cPhone = Clientes->Telefono
nAge = Clientes->Edad



DEFINE FONT oFont NAME "Arial" SIZE 0, -8
DEFINE FONT oFont1 NAME "Arial" SIZE 0, -68
ShowKeyboard()

DEFINE DIALOG oDlg TITLE If( lAppend, "New", "Update" )

@ 0, 0 FOLDER oFld PROMPTS "Generale", "Dettagli", "Note" ;
SIZE 119,95


@ 1, 0 SAY "&Cliente :" OF oFld:aDialogs[ 1 ] SIZE 40,10
@ 2, 0 SAY "&Cliente :" OF oFld:aDialogs[ 1 ] SIZE 40,10

/*@ 11, 0 SAY "&Indirizzo:" OF oFld:aDialogs[ 1 ] PIXEL
@ 12, 0 SAY "&Cliente :" OF oFld:aDialogs[ 1 ] PIXEL
@ 13, 0 SAY "&Indirizzo:" OF oFld:aDialogs[ 1 ] PIXEL
@ 14, 0 SAY "&Cliente :" OF oFld:aDialogs[ 1 ] PIXEL
@ 15, 0 SAY "&Indirizzo:" OF oFld:aDialogs[ 1 ] PIXEL
@ 16, 0 SAY "&Cliente :" OF oFld:aDialogs[ 1 ] PIXEL
@ 17, 0 SAY "&Indirizzo:" OF oFld:aDialogs[ 1 ] PIXEL


/* @ 1, 0 GET cName OF oFld:aDialogs[ 1 ] size 40,10
@ 1, 6 GET cAddress OF oFld:aDialogs[ 1 ] size 40,10




@ 3, 1 TO 7, 8 LABEL "&Products" OF oFld:aDialogs[ 1 ]
@ 4, 2 CHECKBOX lFivePro PROMPT "&FivePro" OF oFld:aDialogs[ 1 ] size 40,10
@ 5, 2 CHECKBOX lDialog PROMPT "&Dialog" OF oFld:aDialogs[ 1 ] size 40,10
@ 6, 2 CHECKBOX lObjects PROMPT "&Objects"OF oFld:aDialogs[ 1 ] size 40,10



* @ 0.5, 1 GET cName1 SIZE 60, 20 OF oFld:aDialogs[ 1 ]
*/

ACTIVATE DIALOG oDlg ;
ON INIT ( DlgFullScreen( oDlg:hWnd ), oDlg:SetMenu( DialogButtons(oDlg) ) )
HideKeyboard()



msginfo(lSave)


IF lSave :=.t.
? "I'here"
ELSE
? "I'm not here"
ENDIF



return nilBest

function DialogButtons(oDlg)

local oMenu

DEFINE MENU oMenu RESOURCE 102 ;
BITMAPS 10 ; // bitmap resources ID
IMAGES 2 // number of images in the bitmap

REDEFINE MENUITEM ID 110 OF oMenu ACTION (lsave:=.t., MsgInfo( "Nuovo inserimento" ), oDlg:end())
REDEFINE MENUITEM ID 120 OF oMenu ACTION (lsave:=.f.,MsgInfo( "Annulla operazione" ),oDlg:end() )

return oMenu


static Function DialogBar(oDlgClient,oLbx)
local oMenu



DEFINE MENU oMenu RESOURCE 103 ;
BITMAPS 11 ; // bitmap resources ID
IMAGES 6 // number of images in the bitmap
REDEFINE MENUITEM ID 113 OF oMenu ACTION MsgInfo( "new" )
REDEFINE MENUITEM ID 114 OF oMenu ACTION MsgInfo( "edit" )
REDEFINE MENUITEM ID 115 OF oMenu ACTION MsgInfo( "del" )
REDEFINE MENUITEM ID 116 OF oMenu ACTION MsgInfo( "nseek ")
REDEFINE MENUITEM ID 117 OF oMenu ACTION MsgInfo( "PRINT" )
REDEFINE MENUITEM ID 118 OF oMenu ACTION oDlgClient:End()
return oMenu


STATIC FUNCTION PocketEvent( uVal,oDlg,olbx )
*----------------------------------

   DO CASE
      CASE uVal == EVENT_SIP ; Dimensiona(oDlg,olbx)
   ENDCASE

RETU NIL

*---------------------------
STATIC FUNCTION Dimensiona(oDlg,olbx)
*---------------------------

    IF SipInfo()
       MoveWindow( oDlg:hWnd, 25, 0, 240, 187 )
        if olbx   != NIL
            olbx:nheight:=185
        endif
     ELSE
        DlgFullScreen( oDlg:hWnd )
             if olbx   != NIL
            olbx:nheight:=240
        endif
    ENDIF

    oDlg:Refresh()

RETU NIL

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>
HB_FUNC( DLGFULLSCREEN )
{
SHINITDLGINFO shidi;

memset( &shidi, 0, sizeof( SHINITDLGINFO ) );

shidi.dwMask = SHIDIM_FLAGS;
shidi.hDlg = ( HWND ) hb_parnl( 1 );
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;

SHInitDialog( &shidi );
}
 HB_FUNC( SETOKBUTTON )
{
   SHINITDLGINFO shidi;

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = ( HWND ) hb_parnl( 1 );
   shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN;

   SHInitDialog( &shidi );
}


#pragma ENDDUMP
 

test.rc

Code: Select all

#ifdef _CE
   #include "c:\vce\include\arm\windows.h"
   #include "c:\vce\include\arm\commctrl.h"
#endif

#define I_IMAGENONE     (-2)
#define IDS_HELP      104

#ifdef _CE
102 RCDATA
BEGIN
   102, 3,
   0, 110, TBSTATE_ENABLED, TBSTYLE_BUTTON, 201, 0, 0,
   0, 105, TBSTATE_ENABLED, TBSTYLE_SEP, -1, 0, 0,
   1, 120, TBSTATE_ENABLED, TBSTYLE_BUTTON, 202, 0, 0
END
#endif

STRINGTABLE DISCARDABLE
BEGIN
   201 "OK"
   202 "Cancel"
END

102 MENU DISCARDABLE
BEGIN
    MENUITEM "", 110
    MENUITEM "", 120
END

10 BITMAP "./bitmaps/pocket/okcancel.bmp"




 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

Sorry Otto,
But I cannot see the menu on bottom

Why ?

Image
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog

Post by Otto »

Silvio,
this is what i wrote you and the problem.

>I copied together all your posts but if I compile your code the menu is missing.

>Please check where the differences to your original code are.


Please check against your original code which shows the menu.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

I sent a zip on private email
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

Why I cannot see the controls ?

Image
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog

Post by Otto »

Dear Silvio,
on my emulator I can’t see the menu.
I am sorry I can’t help you.
The rc – file does not match the prg file.
DialogButtons is nowhere in the rc file.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: TO ANTONIO : Using menu on the dialog

Post by Silvio »

I sent you all rc and bmp
Best Regards, Saludos

Falconi Silvio
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: TO ANTONIO : Using menu on the dialog RESOLVED!!

Post by Otto »

Hello Silvio,
now with the right rc file it compiles and works.

Your error is that you have set the folder size to small.


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Post Reply