|
Lepe, la utilizacion de los edits (vtAddons), no utilizaran demasiado recursos del sistema (en este momento le tengo miedo a los tedits)?
Probablemente los edis estaran optimizados para ser utilizados sin ningun problema, pero por ahora no los he visto. Ahora tengo otro inconveniente que paso a comentarte:
Yo pensaba usar un virtualstringtree con 3 columnas: hora, nombre, servicio.
Este virtualstringtree representaria un gabinete.
Te pido si podes analices el siguiente codigo y me digas que esta mal:
type
ptgabinete = ^ttgabinete;
ttgabinete = record
hora: string[7];
nombre: string[25];
servisesi: string[10];
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
xxx.NodeDataSize := SizeOf(ptgabinete);
end;
procedure TForm1.xxxInitNode(Sender: TBaseVirtualTree; ParentNode,
Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
var data: ptgabinete;
begin
Data := Sender.GetNodeData(Node);
data.hora := '00:00hs'; //hora de prueba
data.nombre := 'Juan'; //nombre de prueba
data.servisesi := 'Masaje'; //servicio de prueba
end;
procedure TForm1.xxxGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
var data: ptgabinete;
begin
Data := Sender.GetNodeData(Node);
case column of
1:
begin
celltext := data.hora;
end;
2:
begin
celltext := data.nombre;
end;
3:
begin
celltext := data.servisesi;
end;
end;
end;
El problema es el siguiente:
Cuando a la propiedad "rootnodecount" del virtualstringtree le pongo 1 y ejecuto la aplicacion funciona perfectamente. Es decir en el virtualstringtree veo la hora, el nombre y la sesion.
Pero cuando a la propiedad "rootnodecount" le pongo un numero mayor se produce el siguiente error:
Proyect MDIAPP.exe raised exception class EaccessViolation with message "Access Violation at address 700A2DEE in module MDIAPP.exe". Read of address 0000000B.
Una variante que realice es la siguiente:
A la propiedad "rootnodecount" del virtualstringtree le pongo 0, depues en un boton pongo la siguiente instruccion:
procedure TForm1.Button4Click(Sender: TObject);
var
node: PVirtualNode;
begin
node := xxx.AddChild(NIL);
end;
La primera vez que presiono el boton se ejecuta bien, es decir veo la hora, nombre y sesion:
HORA NOMBRE SERVICIO
00:00hs Juan Masaje
Pero la segunda vez me empieza a mostrar datos corruptos (basura), hasta que vuelve a aparecer el error que te dije anteriormente:
HORA NOMBRE SERVICIO
00:00hs Juan Masaje
00:00hs xxx9´´´´3333d¡¡¡¡¡¡¡¡¡¡¡dsd¡¡¡¡¡¡¡
00:00hs sdlffj333''''¡¡¡¡¡¡¡'000'0''''''
00:00hs Juan Masaje
Probablemente algun evento estara mal, yo lo que hice fue modificar algunos ejemplos que vino el el manual del vt y tambien del ejemplo que viene con el vt.
Tambien hice lo que pusiste en otro post:
// definimos el registro:
TRecBase = record
Nombre:string[50];
direccion :string[80];
Nivel: Integer;
end;
PTrecBase = ^trecbase;
procedure TForm1.xxxInitNode(Sender: TBaseVirtualTree; ParentNode,
Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
var data: ptgabinete;
begin
Sender.CheckType[Node] := ctTriStateCheckBox;
Sender.CheckState[Node] := csCheckedNormal;
end;
procedure TForm1.xxxGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
var data: ptgabinete;
begin
Data := Sender.GetNodeData(Node);
case column of
1:
begin
celltext := data.hora;
end;
2:
begin
celltext := data.nombre;
end;
3:
begin
celltext := data.servisesi;
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
var
prec: ptgabinete;
i:integer;
node: PVirtualNode;
begin
for i:= 0 to 3 do
begin
node := xxx.AddChild(NIL);
prec := xxx.GetNodeData(node);
prec.hora := 'n ' + inttostr(i);
prec.nombre := 'direc ' + inttostr(i);
prec.servisesi := '2222';
// prec.hora2 := i;
end;
end;
En este caso el error no se produce, pero igual te muestra los datos basura o no te muestra nada en algunos nodos.
Si tenes alguna idea del problema te lo voy a agradecer.
|