FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour error al compilar TREEDRAW.C
Posts: 77
Joined: Wed Jun 28, 2006 06:38 PM
error al compilar TREEDRAW.C
Posted: 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.

Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: error al compilar TREEDRAW.C
Posted: 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
Posts: 77
Joined: Wed Jun 28, 2006 06:38 PM
error al compilar TREEDRAW.C
Posted: Sat Jul 26, 2008 01:00 AM

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

gracias por tu respuesta

Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
error al compilar TREEDRAW.C
Posted: Sat Jul 26, 2008 02: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
error al compilar TREEDRAW.C
Posted: Sat Jul 26, 2008 04:48 AM

Alex,

define HB_IT_OBJECT 0x08000

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 77
Joined: Wed Jun 28, 2006 06:38 PM
error al compilar TREEDRAW.C
Posted: Sat Jul 26, 2008 05: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-&gt;hDC, hDotPen );

   while( nIndent1 &gt; 0 ) {

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

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

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

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

}

if( nStyle & TVS_HASBUTTONS )
{

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

   tempRct.top    = lp-&gt;rcItem.top;
   tempRct.left   = lp-&gt;rcItem.left;
   tempRct.bottom = lp-&gt;rcItem.bottom;
   tempRct.right  = lp-&gt;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 &amp; TIS_PARENT ) {

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

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

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

   }

   SelectObject( lp-&gt;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-&gt;itemState &amp; ODS_FOCUS )
      DrawFocusRect( lp-&gt;hDC, &amp;lp-&gt;rcItem );

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

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

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

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

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

 case ODA_FOCUS:
          GetClassName( GetParent( lp-&gt;hwndItem ), szName, 30 );
      if( lp-&gt;CtlType == ODT_COMBOBOX || szName[ 5 ] != '0' )
      DrawFocusRect( lp-&gt;hDC, &amp;lp-&gt;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 );
}

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
error al compilar TREEDRAW.C
Posted: Sat Jul 26, 2008 05: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

Continue the discussion