Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Arreglo De Cadenas : String (https://www.clubdelphi.com/foros/showthread.php?t=31258)

victor2023 03-05-2006 18:46:46

Arreglo De Cadenas : String
 
HOLA A TODOS, TENGO UNA PREGUNTILLA,:confused: , AVER SI ALGUIEN ME PUDIERA AYUDAR, LA SITUACION ESTA ASI := QUIERO MANDAR DATOS A DIFERENTES POSICIONES A UN ARCHIVO DE TEXTO, EJEMPLO := LO QUE TENGO EN UN EDIT MANDARLO AL RENGLON 16 POSICION 20, Y EN OTRO EDIT MANDARLO AL REGLON 16 POSICION 40, EN OTRO EDIT MANDARLO AL RENGLON 14 POSICION 15 ETC.. Y ASI CONSECUTIVAMENTE PERO POR VALORES ALMACENADOS EN VARIABLES, ESPERO QUE ALGUIEN ME PUEDA AYUDAR, SE LOS AGRADECERIA MUCHISIMO... :D

maeyanes 03-05-2006 18:56:53

Hola... bienvenido a estos foros....

Antes que otra cosa... te sugiero que le des una leidita a la Guía de Estilo de estos foros...


Saludos...

marcoszorrilla 03-05-2006 18:58:27

victor2023:

Convendría te leyeras la "Guía de Estilo", verás que escribir todo en mayúsculas significa chillar, también verás otras cosas importantes a la hora de publicar mensajes en los Foros, la lectura te llevará unos 5 minutos y el adaptarte a las normas citadas no supondrá esfuerzo alguno, todo ello redundará en el bien de los Foros y de todos nosotros.

Tocante al tema planteado, aunque no acabo de verlo claro, sino me equivoco en lo que pides, tendrías que utilizar una TStringList para recuperar el archivo de texto con el método LoadFromFile ......

Un Saludo.

freelance 11-05-2006 00:34:30

Pues ...
 
Código Delphi [-]
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Memo1: TListBox;
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
  // el buffer para el texto
  // ej. 100 x 100 caracteres
  texto : array[0..99] of array[0..100] of Char;
 
implementation
 
{$R *.dfm}
 
// x -> coordenada vertical
// y -> coordenada horizontal
 
procedure WordToPosHor(x, y: integer; TheWord: string);
var
   i: integer;
begin
   for i := 0 to length(TheWord)-1 do
      texto[x, y+i] := TheWord[i+1];
end;
 
procedure WordToPosVer(x, y: integer; TheWord: string);
var
   i: integer;
begin
   for i := 0 to length(TheWord)-1 do
      texto[x+i, y] := TheWord[i+1];
end;
 
procedure TForm1.FormCreate(Sender: TObject);
var
   i: integer;
begin
   FillChar(texto, 100*101, 32);
   WordToPosHor(5, 5, 'pepe');
   WordToPosVer(25, 25, 'ejemplo de palabra');
   WordToPosHor(15, 5, 'hola que tal');
   WordToPosHor(16, 5, 'hola que tal');
   Repaint;
end;
 
procedure TForm1.FormPaint(Sender: TObject);
var
   h, i: integer;
begin
   Memo1.Clear;
   for i := 0 to 99 do
   begin
      texto[i,100] := #0;
      Memo1.Items.Add(strPas(texto[i]));
   end;
end;
 
end.

Prueba con esto.

Crea un formulario.
Pega un TListBox (y llámalo Memo1) en el formulario.

espero haberte ayudado....

vtdeleon 11-05-2006 01:27:45

Saludos

freelance, utiliza las etiquetas para los codigos!

Edita tu mensaje para que veas como se usan.

victor2023 17-05-2006 20:05:54

gracias por contestar mi pregunta, voy a probar con las dos ideas

Alfredo 19-05-2006 22:41:44

interesante este tema... felicito a freelance...

es muy deseable que se lea la guia de estilo, pero es muy bueno cuando ademas se ayuda....;)


La franja horaria es GMT +2. Ahora son las 00:10:34.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi