error al compilar TREEDRAW.C

error al compilar TREEDRAW.C

Postby alex_cyr » Sat Jul 26, 2008 12:44 am

que tal compañeros estoy queriendo compilar treedraw.c y la verdad ya le busque un buen rato pero no doy con la solucion que a mi parecer debe ser algo muy simple pero bueno, esto es lo que me arroja al compilar:

undefined symbol "OBJECT" in function HB_FUN_LBSETDATA


Aqui la funcion en cuestion:

HARBOUR HB_FUN_LBSETDATA() // ( hwnd, index, data )
{
_retni( SendMessage( (HWND) _parnl( 1 ), LB_SETITEMDATA, _parni( 2 ),
(LONG) hb_gcGripGet( _param( 3, OBJECT ) ) ) );
}



saludos.
Alex.
alex_cyr
 
Posts: 77
Joined: Wed Jun 28, 2006 6:38 pm
Location: Chihuahua

Re: error al compilar TREEDRAW.C

Postby wmormar » Sat Jul 26, 2008 12:47 am

Alex,

OBJECT es una variable y no se encuentra definida, hay que definirla al inicio del archivo. Sólo habría que saber de que tipo y valor

alex_cyr wrote:que tal compañeros estoy queriendo compilar treedraw.c y la verdad ya le busque un buen rato pero no doy con la solucion que a mi parecer debe ser algo muy simple pero bueno, esto es lo que me arroja al compilar:

undefined symbol "OBJECT" in function HB_FUN_LBSETDATA


Aqui la funcion en cuestion:

HARBOUR HB_FUN_LBSETDATA() // ( hwnd, index, data )
{
_retni( SendMessage( (HWND) _parnl( 1 ), LB_SETITEMDATA, _parni( 2 ),
(LONG) hb_gcGripGet( _param( 3, OBJECT ) ) ) );
}



saludos.
Alex.
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Postby alex_cyr » Sat Jul 26, 2008 1:00 am

William, ese es el problema no se como definirla, ni que tipo sea :?

gracias por tu respuesta
alex_cyr
 
Posts: 77
Joined: Wed Jun 28, 2006 6:38 pm
Location: Chihuahua

Postby wmormar » Sat Jul 26, 2008 2:36 am

mi correo de messenger es:

wmormar@hotmail.com

para que charlemos y logremos algo

saludos

alex_cyr wrote:William, ese es el problema no se como definirla, ni que tipo sea :?

gracias por tu respuesta
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Postby Antonio Linares » Sat Jul 26, 2008 4:48 am

Alex,

#define HB_IT_OBJECT 0x08000
regards, saludos

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

Postby alex_cyr » Sat Jul 26, 2008 5:51 pm

gracias Willian, ya te agrege...

Antonio, ya se soluciono el problema de la variable OBJECT pero ahora me dice que no existen las siguientes funciones y estas estan dentro de TREEVIEW.C

unresolved external _HB_FUN_TREEMEASURE
unresolved external _HB_FUN_LBXGETID
unresolved external _HB_FUN_TREEDRAWITEM
unresolved external _HB_FUN_SETMASKED


con excepcion de SETMASKED todas estan dentro de TREEWIEV (aunque les falta una letra pero aun poniendola no funciona)

ANEXO EL TREEVIEW.C


#include <Winten.h>
#include <Windows.h>
#include <ClipApi.h>


#ifndef __FLAT__
void _retds( char * );
#else
DWORD GetTextExtent( HDC hdc, LPCSTR lpszString, int cbString );
DWORD MoveTo( HDC hdc, int x, int y );
#ifndef __HARBOUR__
#include <fwxbase.h>
#else
#include <fwHarb.h>
#endif
#endif

#define OBJECT 0x08000

#define TVS_HASBUTTONS 1
#define TVS_HASLINES 2

#define TIS_NORMAL 0
#define TIS_FIRST 1
#define TIS_LAST 2
#define TIS_PARENT 4
#define TIS_OPEN 8

void DrawBitmap( HDC, HBITMAP, int, int, int, int, LONG );

HARBOUR HB_FUN_TreeMeasur() // e( LPMEASUREITEMSTRUCT mi, nHeight )
{
LPMEASUREITEMSTRUCT pMeasure = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );

pMeasure->itemHeight = _parni( 2 );

_retl( TRUE );
}

HARBOUR HB_FUN_TreeDrawIt() // em( LPDRAWITEMSTRUCT lp, cPrompt, nLevel, nIndent,
// unStyle, aItemStyles, aiBmp, aBitmaps, aMasks )
{
LPDRAWITEMSTRUCT lp = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
RECT tempRct;
HPEN hDotPen, hOldPen;
BOOL firstDraw = TRUE;
int centerX, centerY, x, y;
COLORREF rgbFore, rgbBack;
BYTE szName[ 30 ];
int nLevel = _parni( 3 );
int nLevel1 = nLevel;
int nIndent = _parni( 4 );
int nIndent1 = nIndent;
DWORD nStyle = (DWORD) _parnl( 5 );
WORD wItemStyle = _parni( 6, nLevel1 );
HBRUSH hBrush, hOldBrush;

if( nStyle & TVS_HASLINES )
{
tempRct.top = lp->rcItem.top;
tempRct.left = lp->rcItem.left;
tempRct.bottom = lp->rcItem.bottom;
tempRct.right = lp->rcItem.right;

tempRct.right = nIndent * nLevel;
tempRct.left = tempRct.right - nIndent;

hDotPen = CreatePen( PS_SOLID, 0, RGB( 128, 128, 128 ) );
hOldPen = SelectObject( lp->hDC, hDotPen );

while( nIndent1 > 0 ) {

centerX = tempRct.left + ( tempRct.right - tempRct.left ) / 2;
centerY = tempRct.top + ( tempRct.bottom - tempRct.top ) / 2;

if( firstDraw ) {
firstDraw = FALSE;
if( (wItemStyle & TIS_FIRST) && (nLevel == 1) ) {
MoveTo( lp->hDC, centerX, tempRct.bottom );
LineTo( lp->hDC, centerX, centerY );
LineTo( lp->hDC, tempRct.right, centerY );
}
else if( wItemStyle & TIS_LAST ) {
MoveTo( lp->hDC, centerX, tempRct.top );
LineTo( lp->hDC, centerX, centerY );
LineTo( lp->hDC, tempRct.right, centerY );
}
else {
MoveTo( lp->hDC, centerX, tempRct.top );
LineTo( lp->hDC, centerX, tempRct.bottom );
MoveTo( lp->hDC, centerX, centerY );
LineTo( lp->hDC, tempRct.right, centerY );
}
}
else
{
if( !(wItemStyle & TIS_LAST ) ) {
MoveTo( lp->hDC, centerX, tempRct.top );
LineTo( lp->hDC, centerX, tempRct.bottom );
MoveTo( lp->hDC, centerX, centerY );
}
}

tempRct.left -= nIndent;
tempRct.right -= nIndent;
nIndent1--;
--nLevel1;
wItemStyle = _parni( 6, nLevel1 );

}
SelectObject( lp->hDC, hOldPen );
DeleteObject( hDotPen );
}

if( nStyle & TVS_HASBUTTONS )
{

hBrush = CreateSolidBrush( GetSysColor( COLOR_HIGHLIGHTTEXT ) );
hOldBrush = SelectObject( lp->hDC, hBrush );

tempRct.top = lp->rcItem.top;
tempRct.left = lp->rcItem.left;
tempRct.bottom = lp->rcItem.bottom;
tempRct.right = lp->rcItem.right;

tempRct.right = nIndent * nLevel;
tempRct.left = tempRct.right - nIndent;

centerX = tempRct.left + ( tempRct.right - tempRct.left ) / 2;
centerY = tempRct.top + ( tempRct.bottom - tempRct.top ) / 2;

tempRct.left = centerX - 4;
tempRct.right = centerX + 5;

tempRct.top = centerY - 4;
tempRct.bottom = centerY + 5;

wItemStyle = _parni( 6, nLevel );
if ( wItemStyle & TIS_PARENT ) {

Rectangle( lp->hDC, tempRct.left, tempRct.top, tempRct.right, tempRct.bottom );

// -
y = tempRct.top + ( tempRct.bottom - tempRct.top ) / 2;
MoveTo( lp->hDC, tempRct.left + 2, y );
LineTo( lp->hDC, tempRct.right - 2, y );

if( !(wItemStyle & TIS_OPEN) ) {
x = tempRct.left + ( tempRct.right - tempRct.left ) / 2;
MoveTo( lp->hDC, x, tempRct.top + 2 );
LineTo( lp->hDC, x, tempRct.bottom - 2 );
}

}

SelectObject( lp->hDC, hOldBrush );
DeleteObject( hBrush );
}

lp->rcItem.left += nLevel * nIndent;

if( wItemStyle & TIS_OPEN ) {
if( _parni( 7, 1 ) != 0 ) {
DrawBitmap( lp->hDC, ( HBITMAP ) _parni( 8, _parni( 7, 1 ) ), lp->rcItem.top, lp->rcItem.left, 0, 0, 0 );
lp->rcItem.left += 18;
}
}
else {
if( _parni( 7, 2 ) != 0 ) {
DrawBitmap( lp->hDC, ( HBITMAP ) _parni( 8, _parni( 7, 2 ) ), lp->rcItem.top, lp->rcItem.left, 0, 0, 0 );
lp->rcItem.left += 18;
}
}

lp->rcItem.right = lp->rcItem.left + LOWORD( GetTextExtent( lp->hDC, _parc( 2 ), _parclen( 2 ) ) ) + 4;

if( lp->itemID == -1 )
{
DrawFocusRect( lp->hDC, &lp->rcItem );
_retl( TRUE );
return;
}
else
{
switch( lp->itemAction )
{
case ODA_DRAWENTIRE:
case ODA_SELECT:

if( lp->itemState & ODS_FOCUS )
DrawFocusRect( lp->hDC, &lp->rcItem );

if( lp->itemState & ODS_SELECTED )
{
rgbFore = SetTextColor( lp->hDC, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
rgbBack = SetBkColor( lp->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
}

ExtTextOut( lp->hDC, lp->rcItem.left + 2, lp->rcItem.top + 1,
ETO_CLIPPED | ETO_OPAQUE, &lp->rcItem,
_parc( 2 ),
_parclen( 2 ), 0 );

// DrawText( lp->hDC, _parc( 2 ), -1, &lp->rcItem,
// DT_SINGLELINE | DT_VCENTER | DT_CENTER );

if( lp->itemState & ODS_FOCUS )
DrawFocusRect( lp->hDC, &lp->rcItem );

if( lp->itemState & ODS_SELECTED )
{
SetTextColor( lp->hDC, rgbFore );
SetBkColor( lp->hDC, rgbBack );
}
break;

case ODA_FOCUS:
GetClassName( GetParent( lp->hwndItem ), szName, 30 );
if( lp->CtlType == ODT_COMBOBOX || szName[ 5 ] != '0' )
DrawFocusRect( lp->hDC, &lp->rcItem );
break;
}
}
_retl( TRUE );
}

HARBOUR HB_FUN_LbxGetID() // ( LPDRAWITEMSTRUCT lp )
{
LPDRAWITEMSTRUCT lp = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
_retni( lp->itemID );
}

HARBOUR HB_FUN_LBSETDATA() // ( hwnd, index, data )
{
_retni( SendMessage( (HWND) _parnl( 1 ), LB_SETITEMDATA, _parni( 2 ),
(LONG) hb_gcGripGet( _param( 3, OBJECT ) ) ) );
}

HARBOUR HB_FUN_LBGETDATA() // ( hwnd, index, lDelete )
{
PCLIPVAR p = (PCLIPVAR) SendMessage( (HWND) _parnl( 1 ), LB_GETITEMDATA, _parni( 2 ), 0 );

#ifndef __FLAT__
_bcopy( (LPBYTE) _eval, (LPBYTE) p, sizeof(CLIPVAR) );
#else
#endif

if( (BOOL) _parl( 3 ) )
hb_gcGripDrop( p );

}

HARBOUR HB_FUN_LBGETRECT() // ( hwnd, nIndex )
{
RECT rect;

_retni( SendMessage( (HWND) _parnl( 1 ), LB_GETITEMRECT, _parni( 2 ),
(LPARAM) (LPRECT) &rect ) );

_reta( 4 );
_storni( rect.top, -1, 1 );
_storni( rect.left, -1, 2 );
_storni( rect.bottom, -1, 3 );
_storni( rect.right, -1, 4 );
}
alex_cyr
 
Posts: 77
Joined: Wed Jun 28, 2006 6:38 pm
Location: Chihuahua

Postby Antonio Linares » Sat Jul 26, 2008 5:53 pm

Cambia los nombres de las funciones HB_FUN_... a mayúsculas en el código en C
regards, saludos

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests