Ver Mensaje Individual
  #4  
Antiguo 14-12-2017
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Reputación: 11
aguml Va por buen camino
He conseguido solucionarlo casi todo y ha quedado asi:
Código PHP:
//Funcion que controla el evento de desplazamiento del raton sobre los items del combobox de los mapas
void __fastcall TForm1::AppIdle(TObject *Senderbool &done)
{
    
TPoint pt;
    
HWND HWL;

    
RECT rcItem;

    
GetCursorPos( &pt );
    
HWL WindowFromPointpt );

    if ( 
HWL != )
    {
        
char buff[128];
        
GetClassNameHWLbuffsizeofbuff ) );
        if ( 
StrICompbuff"ComboLBox" ) == 0)
        {
            
int inx;
            if ( 
FInCBox)
            {
                ::
ScreenToClientHWL, &pt );
                
inx LOWORDSendMessageHWLLB_ITEMFROMPOINT0,
                (
LPARAM)MAKELONG(pt.xpt.y)));

                if ( 
inx >= ){
                    
//Aqui muestro la imagen
                    
if(FInCBoxMaps && lastIndex != inx){
                        
MostrarImagenMapa(inx);
                        
lastIndex=inx;
                    }

                    
//memset(textoHint,'\0',sizeof(textoHint));

                    //Obtengo la cadena del item
                    
SendMessageHWLLB_GETTEXTinxint(&textoHint));
                    
//Obtengo su posicion en la lista
                    
SendMessageHWLLB_GETITEMRECTinx, (LPARAM)&rcItem);
                }
            }
            
//Muestro el hint siempre y cuando sea diferente al que ya se esta mostrando
            
if(pt.>= rcItem.left && pt.<= rcItem.right && pt.>= rcItem.top && pt.<= rcItem.bottom)
            {
                
//Vuelvo a mostrarlo siempre que sea uno diferente al anterior
                
if(StrIComptextoHinthint->Caption.c_str()) != 0)
                {
                    
//Necesario para saber la posicion relativa para mostrar el hint
                    
::ClientToScreen(HWL, &pt);
                    
//int largo=SendMessage( HWL, LB_GETTEXTLEN,inx,0);
                    
                    
rcItem.left=pt.x;
                    
rcItem.top=pt.y;
                    
rcItem.right=pt.300//Necesito el ancho justo de lo que ocupa el texto porque esto no funciona asi
                    
rcItem.bottom=pt.15//Necesito el alto justo de lo que ocupa el texto
                    
hint->Caption=textoHint;
                    
hint->Color=clInfoBk;
                    
hint->ActivateHint(rcItem,textoHint);
                }
            }
        }else{
            if(
hint != NULL){
                
hint->ReleaseHandle();
                
hint->Caption="";
            }
        }
    }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ComboBoxMapasDropDown(TObject *Sender)
{
    
hint= new THintWindow(ComboBoxMapas->Handle);
    
FInCBoxMaps true;
    
FInCBox true;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ComboBoxMapasCloseUp(TObject *Sender)
{
    if(
hint != NULL){
        
delete hint;
        
hint=NULL;
    }
    
ComboBoxMapas->Hint ComboBoxMapas->Items->Strings[ComboBoxMapas->ItemIndex];
    
FInCBoxMaps false;
    
FInCBox false;
    
MostrarImagenMapa(ComboBoxMapas->ItemIndex);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ComboBoxsDropDown(TObject *Sender)
{
    
hint= new THintWindow(ComboBoxMapas->Handle);
    
FInCBox true;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ComboBoxsCloseUp(TObject *Sender)
{
    
TComboBox *CB static_cast<TComboBox*>(Sender);
    
CB->Hint CB->Items->Strings[CB->ItemIndex];
    if(
hint != NULL){
        
delete hint;
        
hint=NULL;
    }
    
FInCBox false;
}
//--------------------------------------------------------------------------- 
Lo que me falta es asignar el tamaño correcto al Hint para que se vea del largo del texto pero no se como hacerlo y ya llevo dos dias con esto.
Responder Con Cita