Problem with menu

Problem with menu

Postby JoaquimC » Tue Feb 20, 2007 3:57 pm

I have a file named 'gertal2.prg', on that file i define a window with a menu. There's no problem with compilation, i got no error, but when i run the program i see no menu.

The code is:
Code: Select all  Expand view  RUN
#include "FWCE.ch"
STATIC oWnd, oMenu

function Main()
   desenhar_janela()
return nil

// Defining window
function desenhar_janela()
      DEFINE WINDOW oWnd TITLE "Gertal, S.A." menu build_menu()
      @ 3, 3 say "Sistema de Gestão de Pedidos Hospitalares" size 230, 30 pixel
      ACTIVATE WINDOW oWnd modal
return nil


// Create menu
function Build_Menu()
Define Menu oMnu Resource 2002
   ReDefine MenuItem Id 6001 Of oMnu Action oWnd:End()
   ReDefine MenuItem Id 6002 Of oMnu Action msginfo("1")
   ReDefine MenuItem Id 6003 Of oMnu Action msginfo("2")
return nil
   


And i have a resource file, named 'gertal2.rc' with the following code:
Code: Select all  Expand view  RUN
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 4.50".

#include <windows.h>
#include <commctrl.h>
#include "c:\programas\pellesc\include\win\richedit.h"

LANGUAGE LANG_PORTUGUESE,SUBLANG_PORTUGUESE

2002 MENUEX
BEGIN
  POPUP "&Ficheiros", 0, 0, 0
  BEGIN
    MENUITEM "&Sair", 6001, 0, 0
  END
  POPUP "&Opções", 0, 0, 0
  BEGIN
    MENUITEM "&Inserir registo", 6002, 0, 0
    MENUITEM "&Apagar registo", 6003, 0, 0
  END
END


What is wrong with this code?

TIA,
Joaquim
JoaquimC
 
Posts: 16
Joined: Fri Feb 09, 2007 6:43 pm
Location: Porto - Portugal

Postby Antonio Linares » Tue Feb 20, 2007 6:19 pm

Joaquim,

Windows Mobile requires some extra information to build the menu. Please review samples\TestMnu2.rc.

All this data is required. You have to add it manually, PellesC will not create it for you:
Code: Select all  Expand view  RUN
#define I_IMAGENONE      (-2)

#ifdef _CE
102 RCDATA
BEGIN
  102, 3,
  I_IMAGENONE, 100, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, 100, 0, 0, 
  I_IMAGENONE, 200, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, 200, 0, 1, 
  I_IMAGENONE, 300, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, 300, 0, 2 
END
#endif

STRINGTABLE DISCARDABLE
BEGIN
   100 "Maestros"
   200 "Varios"
   300 "Ayuda"
END

102 MENU DISCARDABLE
BEGIN
    POPUP ""
    BEGIN
        MENUITEM "Clientes",    110
        MENUITEM "Proveedores", 120
        POPUP "Artículos"
        BEGIN
           MENUITEM "Añadir",    1310
           MENUITEM "Modificar", 1320
           MENUITEM "Eliminar",  1330
        END
    END

    POPUP ""
    BEGIN
        MENUITEM "Albaranes", 210
        MENUITEM "Facturas", 220
    END

    POPUP ""
    BEGIN
        MENUITEM "Manual", 310
        MENUITEM SEPARATOR
        MENUITEM "Acerca de...", 320
    END
END
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 JoaquimC » Tue Feb 20, 2007 6:49 pm

Thank you Antonio,

But can you send me a working sample?
I tried with the one you send me, i even tried with the testmnu2.prg, without any modification (compiled it and send it to the PPC) and the result was always the same: nothing happened, i.e.: i see the window, i don't see any menu...

Thank you,
Joaquim
JoaquimC
 
Posts: 16
Joined: Fri Feb 09, 2007 6:43 pm
Location: Porto - Portugal

Postby Antonio Linares » Tue Feb 20, 2007 6:54 pm

Joaquim,

Already sent.

Please check that your RC properly compiles into a RES file without errors
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 JoaquimC » Tue Feb 20, 2007 7:24 pm

Thank you Antonio,

I get it going.
I think the problem is with Pelles: every time you open a resource file with it, pelles removes some information that you'll need.

Joaquim
JoaquimC
 
Posts: 16
Joined: Fri Feb 09, 2007 6:43 pm
Location: Porto - Portugal


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 5 guests