Ver Mensaje Individual
  #12  
Antiguo 20-02-2018
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.264
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por DrakStorm Ver Mensaje
...si tienes una solución mucho mas optima te lo agradecería mucho.
En el mensaje anterior te comenté algunas opciones.

La primera a probar sería utilizando la popiedad ZIndex de cada marca en lugar del ID. Parece que ese índice sí se resetea al hacer el Clear.
Código Delphi [-]

  GMMark2.items[linkedcomponent.ZIndex].title

La segunda (y ahora me acabo de dar cuenta) es utilizar d9irectamente la propiedad de la marca, en lugar de buscar en la lista el título, ya que también la tiene. Es decir, utilizar esto para acceder al título:

Código Delphi [-]
  AQmap.SQL.Text := 'select id, tipodelito, otros from oficios WHERE id="'+TMarker(linkedcomponent).title+'"';
Y en todo caso, comprobar antes que linkedcomponent es un TMarker.

La tercera, que también te he comentado, es usar una función para buscar el título que esperas sin usar el ID.

Código Delphi [-]
function GetTitle(GMMarker:TGMMarker; LinkedComponent: TLinkedComponent):string;
var
  i:integer;
begin
  Result := '';
  for i := 0 to (GMMarker.Count - 1) do begin
    if (GMMarker.Items[i] = LinkedComponent) then begin
      Result := GMMarker.Items[i].Title;
      Break;
    end;
  end;
end;

En este caso usarías algo así:

Código Delphi [-]
AQmap.SQL.Text := 'select id, tipodelito, otros from oficios WHERE id="'+GetTitle(GMMark2, linkedcomponent)+'"';

Más o menos son las que se me ocurren.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita