CnPack Forum


 
Subject: Wizard Delphi 7 好像是Bug
listary
新警察
Rank: 1



UID 42071
Digest Posts 0
Credits 25
Posts 9
点点分 25
Reading Access 10
Registered 2009-3-26
Status Offline
Post at 2009-3-26 14:11  Profile | Blog | P.M. 
Wizard Delphi 7 好像是Bug

Delphi 7 Wizard
出现了重叠字符,但不影响编译,见图片


Image Attachment: 未命名.bmp (2009-3-26 14:11, 339.97 K)

Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6804
Posts 3577
点点分 6804
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2009-3-26 15:20  Profile | Blog | P.M. 
能否固定重现?也就是说翻页、滚屏或修改代码后这样的错位是否仍然出现?
Top
listary
新警察
Rank: 1



UID 42071
Digest Posts 0
Credits 25
Posts 9
点点分 25
Reading Access 10
Registered 2009-3-26
Status Offline
Post at 2009-3-26 17:13  Profile | Blog | P.M. 
回复 #2 Passion 的帖子

翻页滚屏依然出现,我在Begin后面增加一个空行就没有字符重叠了,但是Begin end 依然不能加亮显示。
我有两个unit, mainUnit没有这个问题,很正常。
有问题的一个试着修改上边的内容增加或删除行,怎么都不能正常。
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6804
Posts 3577
点点分 6804
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2009-3-26 19:44  Profile | Blog | P.M. 
能否将出问题的这个unit发给我们看看,看是否有什么特殊的地方影响了代码的结构解析?
Top
listary
新警察
Rank: 1



UID 42071
Digest Posts 0
Credits 25
Posts 9
点点分 25
Reading Access 10
Registered 2009-3-26
Status Offline
Post at 2009-3-27 09:11  Profile | Blog | P.M. 
回复 #4 Passion 的帖子

这是部分代码,删除掉前面某些行偶尔可以恢复正常,有时候又不能。

unit unitPPI;

interface

uses
  Windows,  SysUtils, Variants, Classes, Controls, Forms,
    StdCtrls, OoMisc, AdPort, MMsystem;
const
  StationNo = 2;
  Hostnummer     = 0 ;

type
  TfrmPPI = class(TForm)
    PPICom: TApdComPort;

    function OpenCOM(const No: Byte; const Settings:String) : Boolean;
    function CloseCOM : Boolean;
    procedure PPIComTrigger(CP: TObject; Msg, TriggerHandle, Data: Word);


    function ReadVB(const Station :byte; const Addr : Word; var valueWord): boolean;

    function writeVB(const Station :byte; const Addr : Word; const Value : Dword): Boolean;


  private
    { Private declarations }
    portOpened:boolean;
    expectCharNo,realCharNo:word;
    waitData:boolean;
    timerHandle:word;
    retStr:string;
    Bytebuffer   : Array[0..512] of Byte;

  protected
    { Protected declarations }
  public
    { Public declarations }
  end;

  TbyteArray  =Array[0..222] of byte;

var
  frmPPI: TfrmPPI;

  S7Quit : Array[0..5] of Byte = ($10, StationNo, $00, $5C, $5E, $16);



  S7GetVW : Array[0..32] of Byte =($68, $1B, $1B, $68, StationNo, $00,
    $7C, $32, $01, $00, $00, $00, $00, $00, $0E, $00, $00, $04, $01, $12, $0A, $10,
    $02, $00, $02, $00, $01, $84, $00, $03, $20, $9C, $16);


  resetByte: Array [0..26] of Byte =($68,$15,$15,$68,StationNo,$00,$6c,$32,$01,$00,
        $00,$cc,$c1,$00,$08,$00,$00,$f0,$00,$00,$01,$00,$01,$03,$c0,$eb,$16);

implementation

{$R *.dfm}

procedure Delay_MS(const mst : Cardinal);
var
  CDelay: Cardinal;
  CTime: LongInt;
  LTime: LongInt;
begin
  LTime := timeGetTime;
  CDelay := 0;
  while CDelay < mst do begin
    Application.processMessages;
    CTime := timeGetTime;
    Inc(CDelay, CTime - LTime);
    LTime := CTime;
  end;

end;


function TfrmPPI.OpenCOM (const No: Byte; const Settings:String) : Boolean;
begin

  try
    PPICom.ComNumber := No;
    PPICom.Baud :=strtoint(settings);
    ppiCom.Parity :=pEven;
    if not PPICom.Open then PPICom.Open :=true;
    result:=true;
    portOpened:=true;

    //s7GetVL[4]:=Station;
    //s7SetVW[4]:=Station;
    //s7SetVD[4]:=Station;

  except
    portOpened:=false;
    result:=false;

  end;

end;

function TfrmPPI.CloseCOM ():boolean;
begin

if PPICom.Open then PPICom.Open :=false;
portOpened:=false;
result:=true;

end;

procedure TfrmPPI.PPIComTrigger(CP: TObject; Msg, TriggerHandle,  Data: Word);
var
  I : Word;
  c :char;
begin

  case Msg of
    APW_TRIGGERDATA :
      begin
        //overTimeFlag:=false;
      end;
    APW_TRIGGERAVAIL :
      begin

        for I := 1 to Data do begin
          c:= PPICom.GetChar;
          retStr := retStr+c;
          byteBuffer[realCharNo]:=ord(c);
          realCharNo:=realCharNo+1;
        end;

        if expectCharNo=realCharNo then begin
          ppiCom.RemoveTrigger(timerHandle);
          waitData:=false;
        end;

      end;
    APW_TRIGGERTIMER :
      begin
        waitData:=false;
        PPICom.RemoveTrigger(timerHandle);
      end;

  end;

end;


function TfrmPPI.ReadVB(const Station :byte; const Addr : Word; var valueWord): boolean;
var
  I,K : Byte;
  sStr,qStr: string;
begin
  Result := false;
  if (not portOpened) or waitData then exit;

  K:=0;
  s7GetVW[4]:=station;
  S7GetVW[22]:=2;
  S7GetVW[24]:=1;  //读取字节数
  S7GetVW[26]:=1;
  S7GetVW[27]:=$84;
  S7GetVW[29]:=Hi(Addr*8);
  S7GetVW[30]:=Lo(Addr*8);
  for I:=4 to 30 do
    K:=K + S7GetVW[I];
  S7GetVW[31]:=K;

  sStr:='';
  for i:=0 to sizeof(s7GetVW)-1 do sStr:=sStr+char(S7GetVW[I]);
  PPICom.PutString(sStr);

  expectCharNo:=1;
  realCharNo:=0;
  retStr:='';
  timerHandle := PPICom.AddTimerTrigger;
  PPICom.SetTimerTrigger(timerHandle,182,true);

end;

function TfrmPPI.writeVB (const Station :byte; const Addr : Word; const Value : Dword): Boolean;
var
  I,K : Byte;
  sStr,qStr: string;
begin
  Result := false;
  if (not portOpened) or waitData then exit;


end;


end.
Top
listary
新警察
Rank: 1



UID 42071
Digest Posts 0
Credits 25
Posts 9
点点分 25
Reading Access 10
Registered 2009-3-26
Status Offline
Post at 2009-3-27 09:19  Profile | Blog | P.M. 
见图片


Image Attachment: 未命名1.JPG (2009-3-27 09:19, 52.35 K)



Image Attachment: 未命名2.JPG (2009-3-27 09:19, 52.45 K)

Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6804
Posts 3577
点点分 6804
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2009-3-27 10:46  Profile | Blog | P.M. 
这段代码我复制下来显示还是正常的,我猜想可能是文件中有些多余或错乱的回车换行符号导致了行计算错误。能否将原始的unit打包作为附件上传到这儿看看?
Top
 




All times are GMT++8, the time now is 2024-9-17 02:58

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.008975 second(s), 8 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP