Hola foro,
Habra alguna forma de eliminar los ESPACIOS de mas que salen en los sub-menu.
Es decir cuando usamos MENUITEM para crear los sub-menu los espacios a la derecha son mayores que el mensaje, eso se ve bien feo. He buscado por todo lado en la clase menu pero no encuentro nada que me ayude a solucionar ese problema de estetica.
Alguna sugerencia?
Saludos
George
ESPACIOS EN SUB-MENU
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Antonio,
Gracias por la sugerencia. Ahi esta la solucion.
El problema que tengo es que al tratar de compilar el programa añadiendo el archivo "MENUS.C" me genera el siguiente error:
Source File Type Description
Menus.obj Error Couldn't build
Estoy usando xHarbour Builder RC9 + FWH 2.7 aug 06
Coloque los include (.h) en el directorio del programa pero no corrigio el problema.
Sera que debo enlazar otro archivo adicional al MENU.C?
Saludos
George
Gracias por la sugerencia. Ahi esta la solucion.
El problema que tengo es que al tratar de compilar el programa añadiendo el archivo "MENUS.C" me genera el siguiente error:
Source File Type Description
Menus.obj Error Couldn't build
Estoy usando xHarbour Builder RC9 + FWH 2.7 aug 06
Coloque los include (.h) en el directorio del programa pero no corrigio el problema.
Sera que debo enlazar otro archivo adicional al MENU.C?
Saludos
George
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Antonio,
Hice lo anterior, pero sigue el mismo mensaje "Error menus_.obj couldn't build".
Este es el codigo de menus_.c generadro por clp2harb
Saludos
George
[/code]
Hice lo anterior, pero sigue el mismo mensaje "Error menus_.obj couldn't build".
Este es el codigo de menus_.c generadro por clp2harb
Code: Select all
#define OEMRESOURCE
#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>
BOOL bStrAt( BYTE bChar, LPSTR szText );
LPSTR StrToken( LPSTR szText, WORD wOcurrence, BYTE bSeparator, LPWORD pwLen );
void WindowBoxIn( HDC hDC, RECT * pRect );
void WndDrawBox( HDC hDC, RECT * rct, HPEN hPUpLeft, HPEN hPBotRit );
void WindowInset( HDC hDC, RECT * pRect );
void WindowRaised( HDC hDC, RECT * pRect );
void DrawBitmap( HDC, HBITMAP, WORD, WORD, WORD, WORD, DWORD );
void DrawMasked( HDC, HBITMAP, WORD, WORD );
void DrawGrayed( HDC, HBITMAP, int, int );
void RectDisable( HDC, LPRECT );
//----------------------------------------------------------------------------//
HB_FUNC( CREATEMENU)
{
_retnl( ( LONG ) CreateMenu() );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( CREATEPOPUPMENU)
#else
HB_FUNC( CREATEPOPU)
#endif
{
_retnl( ( LONG ) CreatePopupMenu() );
}
//----------------------------------------------------------------------------//
HB_FUNC( TRACKPOPUP)
{
_retl( TrackPopupMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 4 ),
_parni( 3 ), _parni( 5 ), ( HWND ) _parni( 6 ), NULL ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( ENABLEMENUITEM)
#else
HB_FUNC( ENABLEMENU) // ITEM()
#endif
{
_retl( EnableMenuItem( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( CHECKMENUITEM) // ()
#else
HB_FUNC( CHECKMENUI) // TEM()
#endif
{
_retl( CheckMenuItem( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( GETMITEMCOUNT) // ()
#else
HB_FUNC( GETMITEMCO) // UNT()
#endif
{
_retni( GetMenuItemCount( ( HMENU ) _parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( GETMITEMID) // hMenu, nPos
{
_retni( GetMenuItemID( ( HMENU ) _parnl( 1 ), _parni( 2 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( GETSYSTEMMENU) // ()
#else
HB_FUNC( GETSYSTEMM) // ENU()
#endif
{
_retnl( ( LONG ) GetSystemMenu( ( HWND ) _parnl( 1 ), _parl( 2 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( DESTROYMENU) // () hMenu
#else
HB_FUNC( DESTROYMEN) // U() hMenu
#endif
{
_retl( DestroyMenu( ( HMENU ) _parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( GETSUBMENU) // hMenu, nPos
{
_retnl( ( LONG ) GetSubMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( GETMENUSTRING) // () hMenu, nId, nPosOrValue
#else
HB_FUNC( GETMENUSTR) // ING() hMenu, nId, nPosOrValue
#endif
{
BYTE bBuffer[ 200 ];
WORD wLen = GetMenuString( ( HMENU ) _parnl( 1 ), _parni( 2 ), ( char * ) bBuffer,
199, _parni( 3 ) );
_retclen( ( char * ) bBuffer, wLen );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( GETMENUSTATE) // () hMenu, nId, nFlags
#else
HB_FUNC( GETMENUSTA) // TE() hMenu, nId, nFlags
#endif
{
_retni( GetMenuState( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( DRAWMENUBAR) // () hWnd
#else
HB_FUNC( DRAWMENUBA) // R() hWnd
#endif
{
DrawMenuBar( ( HWND ) _parnl( 1 ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( HILITEMENUITEM) // () hWnd, hMenu, idItem, nHiliteFlags
#else
HB_FUNC( HILITEMENU) // ITEM() hWnd, hMenu, idItem, nHiliteFlags
#endif
{
_retl( HiliteMenuItem( ( HWND ) _parnl( 1 ), ( HMENU ) _parnl( 2 ),
_parni( 3 ), _parni( 4 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( LOADMENU)
{
_retnl( ( LONG ) LoadMenu( ( HINSTANCE ) _parnl( 1 ),
( LPSTR ) IF( ISCHAR( 2 ), _parc( 2 ),
MAKEINTRESOURCE( _parni( 2 ) ) ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( APPENDMENU)
{
_retl( AppendMenu( ( HMENU ) _parnl( 1 ), ( UINT ) _parnl( 2 ), _parnl( 3 ),
IF( ISCHAR( 4 ), _parc( 4 ), ( LPSTR ) _parnl( 4 ) ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( SETMENU)
{
_retl( SetMenu( ( HWND ) _parnl( 1 ), ( HMENU ) _parnl( 2 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( MODIFYMENU)
{
_retl( ModifyMenu( ( HMENU ) _parnl( 1 ), ( UINT ) _parni( 2 ),
_parni( 3 ), ( UINT ) _parni( 4 ),
IF( ISCHAR( 5 ), _parc( 5 ), ( LPSTR ) _parnl( 5 ) ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( INSERTMENU) // ( hMenu, nIdItem, nFlags, nNewItem, cPrompt ) --> lSuccess
{
_retl( InsertMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ),
_parni( 4 ), _parc( 5 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( REMOVEMENU) // ( hMenu, nItem, nFlags ) --> lSuccess
{
_retl( RemoveMenu( ( HMENU ) _parnl( 1 ),
( UINT ) _parni( 2 ),
( UINT ) _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( MENUDRAWITEM) // ( pDrawItemStruct, cPrompt, lTop, hBitmap )
#else
HB_FUNC( MENUDRAWIT) // EM( pDrawItemStruct, cPrompt, lTop, hBitmap )
#endif
{
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
LPSTR szPrompt = _parc( 2 );
BOOL bTab = bStrAt( 9, szPrompt );
WORD wLen;
BOOL bTop = _parl( 3 );
HPEN hNormal;
HBRUSH hBrush;
LOGBRUSH lb;
RECT rct;
HBITMAP hBmp = ( HBITMAP ) _parnl( 4 );
switch( lpdis->itemAction )
{
case ODA_DRAWENTIRE:
case ODA_SELECT:
lb.lbStyle = BS_SOLID;
lb.lbColor = GetSysColor( COLOR_MENU );
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &lpdis->rcItem, hBrush );
DeleteObject( hBrush );
if( lpdis->itemState & ODS_SELECTED &&
! ( lpdis->itemState & ODS_GRAYED ) )
{
lb.lbColor = GetSysColor( COLOR_HIGHLIGHT );
SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
SetTextColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
lpdis->rcItem.left += 19;
}
else
lb.lbColor = GetSysColor( COLOR_MENU );
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &lpdis->rcItem, hBrush );
DeleteObject( hBrush );
if( lpdis->itemState & ODS_SELECTED &&
! ( lpdis->itemState & ODS_GRAYED ) )
lpdis->rcItem.left -= 19;
rct.top = lpdis->rcItem.top;
rct.left = lpdis->rcItem.left;
rct.right = 7;
rct.bottom = lpdis->rcItem.bottom - 1;
if( lpdis->itemState & ODS_SELECTED )
if( ! ( lpdis->itemState & ODS_GRAYED ) &&
! ( lpdis->itemState & ODS_CHECKED ) )
if( hBmp )
WindowRaised( lpdis->hDC, &rct );
else
{
lb.lbColor = GetSysColor( COLOR_HIGHLIGHT );
hBrush = CreateBrushIndirect( &lb );
rct.right += 2;
rct.bottom++;
FillRect( lpdis->hDC, &rct, hBrush );
rct.right -= 2;
rct.bottom--;
DeleteObject( hBrush );
}
if( lpdis->itemState & ODS_CHECKED )
{
HBITMAP hBmp = LoadBitmap( 0, MAKEINTRESOURCE( OBM_CHECK ) );
if( ! ( lpdis->itemState & ODS_SELECTED ) )
DrawGrayed( lpdis->hDC, hBmp, lpdis->rcItem.top + 1,
lpdis->rcItem.left + 1 );
else
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 1,
lpdis->rcItem.left + 1 );
DeleteObject( hBmp );
// WindowInset( lpdis->hDC, &rct );
}
if( hBmp )
{
if( ! ( lpdis->itemState & ODS_CHECKED ) )
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 1,
lpdis->rcItem.left + 1 );
else
if( ! ( lpdis->itemState & ODS_SELECTED ) )
DrawGrayed( lpdis->hDC, hBmp, lpdis->rcItem.top + 1,
lpdis->rcItem.left + 1 );
else
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 1,
lpdis->rcItem.left + 1 );
}
lpdis->rcItem.top += 2;
lpdis->rcItem.left += 21;
if( !bTab )
{
DrawText( lpdis->hDC, szPrompt, -1, &lpdis->rcItem, DT_LEFT );
}
else
{
lpdis->rcItem.right -= 21;
StrToken( szPrompt, 1, 9, &wLen ); // 32 bits does not fill wLen before
DrawText( lpdis->hDC, StrToken(szPrompt, 1, 9, &wLen), wLen, &lpdis->rcItem, DT_LEFT );
StrToken( szPrompt, 2, 9, &wLen ); // 32 bits does not fill wLen before
DrawText( lpdis->hDC, StrToken(szPrompt, 2, 9, &wLen), wLen, &lpdis->rcItem, DT_RIGHT );
lpdis->rcItem.right += 21;
}
lpdis->rcItem.top -= 2;
lpdis->rcItem.left -= 21;
if( lpdis->itemState & ODS_GRAYED )
RectDisable( lpdis->hDC, &lpdis->rcItem );
_retl( TRUE );
break;
case ODA_FOCUS:
_retl( FALSE );
break;
}
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( MENUMEASUREITEM) // ( pMeasureItemStruct, nLen )
#else
HB_FUNC( MENUMEASUR) // EITEM( pMeasureItemStruct, nLen )
#endif
{
LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
lp->itemWidth = _parni( 2 );
lp->itemHeight = GetSystemMetrics( SM_CYMENU ); // 18
}
//----------------------------------------------------------------------------//
HB_FUNC( GETMEAITEM) // ( pMeasureItemStruct ) --> nMenuItemID
{
LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
_retnl( lp->itemID );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( GETDRAWITEM) // ( pDrawItemStruct ) --> nMenuItemID
#else
HB_FUNC( GETDRAWITE) // M( pDrawItemStruct ) --> nMenuItemID
#endif
{
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
_retnl( lpdis->itemID );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUNC( GETDRAWMENU) // ( pDrawItemStruct ) --> hMenu
#else
HB_FUNC( GETDRAWMEN) // U( pDrawItemStruct ) --> hMenu
#endif
{
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
_retnl( ( LONG ) lpdis->hwndItem );
}
//----------------------------------------------------------------------------//
HB_FUNC( ISMENU)
{
_retl( IsMenu( ( HMENU ) _parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
Saludos
George
[/code]