Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 25th, 2004, 12:59 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
Problem using Asyncpro AdxPort.pas form

I am having a small problem using the standard from provided with AsyncPro for setting the port options. Although I can get the window to open none of the current settings are shown and none of the available ports are shown. If I set up a tapi device and use the show config dialog, it does not show any of the direct comports. Can you Async pro guys point me in the right direction. please find following.

Main Form
Code:
unit datacollex;

interface

uses
  ShareMem, Memcheck, Windows, Messages, SysUtils, Variants, Classes, Graphics, 
Controls, ............., OoMisc, AdPort, AdStMach, AdTapi, AdPacket;

type
  TMainForm = class(TForm)
    MainMenu1: TMainMenu;
    SerialPortSettings1: TMenuItem;
    ...................................
    ApdTapiDevice1: TApdTapiDevice;
    ApdComPort1: TApdComPort;
    ApdDataPacket1: TApdDataPacket;

implementation
   uses 
   AdxPort;

procedure TMainForm.SerialPortSettings1Click(Sender: TObject);
begin
ApdTapiDevice1.ShowConfigDialog;
end;


and AdxPort form sorry about how long it is.

Code:
unit AdXPort;

interface

uses
  WinTypes,
  WinProcs,
  ....................
  StdCtrls,
  datacollex,
  AdPort,
  AdTapi,
  AdTSel;

type
  TComPortOptions = class(TForm)
    FlowControlBox: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    DTRRTS: TCheckBox;
    RTSCTS: TCheckBox;
    SoftwareXmit: TCheckBox;
    SoftwareRcv: TCheckBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Bauds: TRadioGroup;
    Paritys: TRadioGroup;
    Databits: TRadioGroup;
    Stopbits: TRadioGroup;
    Comports: TGroupBox;
    OK: TButton;
    Cancel: TButton;
    PortComboBox: TComboBox;
    procedure OKClick(Sender: TObject);
    procedure CancelClick(Sender: TObject);
    procedure PortComboBoxChange(Sender: TObject);
    procedure FormShow(Sender: TObject);

  private
    FShowTapiDevices : Boolean;
    FShowPorts       : Boolean;
    ApdComPort1   : TApdComPort;
    FTapiDevice: string;
    Executed   : Boolean;

  protected
    function GetComPort : TApdComPort;
    procedure SetComPort(NewPort : TApdComPort);

  public
    //constructor Create(AOwner: TComponent); override;
    //destructor Destroy; override;
    function Execute: Boolean;

    property ComPort : TApdComPort
      read GetComPort write SetComPort;
    property TapiDevice : string
      read FTapiDevice write FTapiDevice;
    property ShowTapiDevices : Boolean
      read FShowTapiDevices write FShowTapiDevices;
    property ShowPorts : Boolean
      read FShowPorts write FShowPorts;
  end;

var
  ComPortOptions: TComPortOptions;

implementation

{$R *.DFM}

const
  BaudValues : array[0..9] of Word =
    (30, 60, 120, 240, 480, 960, 1920, 3840, 5760, 11520);



function TComPortOptions.Execute: Boolean;
var
  I : Word;
  CheckBaud : Word;
  E : TDeviceSelectionForm;
begin
  {Update dialog controls}
  Bauds.ItemIndex := 6;
  CheckBaud := ApdComPort1.Baud div 10;
  for I := 0 to 9 do
    if CheckBaud = BaudValues[I] then begin
      Bauds.ItemIndex := I;
      break;
    end;
  Paritys.ItemIndex := Ord(ApdComPort1.Parity);
  Databits.ItemIndex := 8-ApdComPort1.Databits;
  Stopbits.ItemIndex := Pred(ApdComPort1.StopBits);

  {Hardware flow}
  DTRRTS.Checked := hwfUseDTR in ApdComPort1.HWFlowOptions;
  RTSCTS.Checked := hwfUseRTS in ApdComPort1.HWFlowOptions;

  {Software flow}
  SoftwareXmit.Checked := (ApdComPort1.SWFlowOptions = swfBoth) or
                          (ApdComPort1.SWFlowOptions = swfTransmit);
  SoftwareRcv.Checked := (ApdComPort1.SWFlowOptions = swfBoth) or
                         (ApdComPort1.SWFlowOptions  = swfReceive);
  Edit1.Text := IntToStr(Ord(ApdComPort1.XOnChar));
  Edit2.Text := IntToStr(Ord(ApdComPort1.XOffChar));

  {Gather all tapi devices and ports}
  E := TDeviceSelectionForm.Create(Self);
  try
          E.ShowTapiDevices := ShowTapiDevices;
    E.ShowPorts       := ShowPorts;
    E.EnumAllPorts;
    PortComboBox.Items := E.PortItemList;
  finally;
    E.Free;
  end;

  ShowModal;
  Result := ModalResult = mrOK;
  Executed := Result;
end;

function TComPortOptions.GetComPort : TApdComPort;
var
  HWOpts : THWFlowOptionSet;
  SWOpts : TSWFlowOptions;
  Temp   : Integer;
  Code   : Integer;
begin
  if Executed then begin
    {Update ComPort from dialog controls}
    ApdComPort1.Baud := LongInt(BaudValues[Bauds.ItemIndex]) * 10;
    ApdComPort1.Parity := TParity(Paritys.ItemIndex);
    ApdComPort1.Databits := 8-Databits.ItemIndex;
    ApdComPort1.Stopbits := Succ(Stopbits.ItemIndex);

    {Update HW flow}
    HWOpts := [];
    if DTRRTS.Checked then
      HWOpts := [hwfUseDTR, hwfRequireDSR];
    if RTSCTS.Checked then begin
      Include(HWOpts, hwfUseRTS);
      Include(HWOpts, hwfRequireCTS);
    end;
    ApdComPort1.HWFlowOptions := HWOpts;

    {Update SW flow}
    if SoftwareXmit.Checked then
      if SoftwareRcv.Checked then
        SWOpts := swfBoth
      else
        SWOpts := swfTransmit
    else if SoftwareRcv.Checked then
      SWOpts := swfReceive
    else
      SWOpts := swfNone;
    ApdComPort1.SWFlowOptions := SWOpts;

    Val(Edit1.Text, Temp, Code);
    if Code = 0 then
      ApdComPort1.XOnChar := Char(Temp);
    Val(Edit2.Text, Temp, Code);
    if Code = 0 then
      ApdComPort1.XOffChar := Char(Temp);
  end;
  Result := ApdComPort1;
end;

procedure TComPortOptions.SetComPort(NewPort : TApdComPort);
begin
  if (NewPort <> ApdComPort1) then
    ApdComPort1.Assign(NewPort);
end;

procedure TComPortOptions.OKClick(Sender: TObject);
begin
  ModalResult := mrOK;
end;

procedure TComPortOptions.CancelClick(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TComPortOptions.PortComboBoxChange(Sender: TObject);
var
  DeviceName : string;
begin
  DeviceName := PortComboBox.Items[PortComboBox.ItemIndex];
  if Pos(DirectTo, DeviceName) > 0 then begin
    ComPort.TapiMode := tmOff;
    ComPort.ComNumber := StrToInt(Copy(DeviceName, Length(DirectTo)+1, Length(DeviceName)));
  end else begin
    ComPort.TapiMode := tmAuto;
    ComPort.ComNumber := 0;
    TapiDevice := DeviceName;
  end;
end;

procedure TComPortOptions.FormShow(Sender: TObject);
begin
 { Highlite the active device in the list }
  with PortComboBox do
    if Assigned(ApdComPort1) and (ComPort.TapiMode = tmOff) then begin
      ItemIndex := Items.IndexOf(DirectTo+IntToStr(ComPort.ComNumber));
    end else begin
      ItemIndex := Items.IndexOf(TapiDevice);
    end;
end;

end.

Reply With Quote
  #2  
Old January 26th, 2004, 04:32 AM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
I can now select a port using ApdTapiDevice1.SelectDevice; but how do I go about configuring the selected port? There seems to be no form for this. if so what is the best way to share the settings for the component between two forms.

Reply With Quote
  #3  
Old January 26th, 2004, 12:30 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,381 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 24 m 14 sec
Reputation Power: 4080
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Reply With Quote
  #4  
Old January 26th, 2004, 07:34 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
I think it would be simplier if I could get to the component properties on the main page. I believe the settings in the windows generated dialog do not work except for baud rate.

If I could do something like the following in the dialog from
Edit1.text := IntToStr(ApdcomPort1.baud);


Where ApdComPort1 is the asyncpro component on the main form, that would be great. I dont know if this is some type of inheritance thing, but a pointer in the right direction would help.

Reply With Quote
  #5  
Old January 26th, 2004, 08:53 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,381 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 24 m 14 sec
Reputation Power: 4080
Ah, that's easy enough then.

Let's say you have form1 and form2, where form2 has the dialog box. Let's say there's a button on form1 that says "config...". First, I would remove Form2 from the list of autocreated forms on startup (Project --> Options --> Forms tab). Here's how I'd do the code:
Code:
--- On unit1
implementation

uses unit2;

procedure TForm1.Button1Click(Sender: TObject);
var
	form2 : TForm2;
begin
	form2 := TForm2.Create(self);
	form2.Parent := self;
	form2.PrepareDisplay;
	form2.ShowModal;
	form2.free;
end;


---- Then on unit2:
type
	TForm2 = class(TForm)
		Label1: TLabel;

	private
		{ Private declarations }
	public
		{ Public declarations }
		procedure PrepareDisplay;
	end;

var
	Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.PrepareDisplay;
var
	parentform : TForm1;
begin
	parentform := self.parent as TForm1;
	label1.Caption := IntToStr(parentform.ApdComPort1.baud);
end;


Hope this helps

Last edited by Scorpions4ever : January 26th, 2004 at 08:58 PM.

Reply With Quote
  #6  
Old January 27th, 2004, 02:27 AM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
Scorpions,
Thanks, it seem to work without to much problem. I had to comment out one line as it was causing problems and so ended up with the following.

Code:
procedure TMainForm.Portsettings1Click(Sender: TObject);
Var
  PortSetupMain: TPortSetupMain;
begin
     PortSetupMain := TPortSetupMain.Create(self);
     try
	//PortSetupMain.Parent := self;
	PortSetupMain.PrepareDisplay;
	PortSetupMain.ShowModal;
        finally
	PortSetupMain.free;
     end
end;


What will be the implication if I do not use that line?

Reply With Quote
  #7  
Old January 27th, 2004, 02:52 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,381 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 24 m 14 sec
Reputation Power: 4080
What error are you getting when you try to set the value of PortSetupMain.Parent? I explicitly set it so that PrepareDisplay could access the parent form (i.e. MainForm) by using the Parent property.

Reply With Quote
  #8  
Old January 27th, 2004, 02:11 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
The error I get is 'Cannot focus a disabled or invisiblw window' when I click on the button to open the dialog window.

Reply With Quote
  #9  
Old January 27th, 2004, 05:36 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
Now the trick is getting the changes back into the component? I unashamedly nick most of the component names fron the async pro dialog and usefd the following to populate the dialog form. I now need to translate all of these back to the component.

Code:
procedure TPortSetupMain.PrepareDisplay;
var
          I : Word;
          CheckBaud : Word;
     parentform : TMainForm;
begin
     parentform := self.parent as TMainForm;

          Bauds.ItemIndex := 6;
  CheckBaud := MainForm.ApdComPort1.Baud div 10;
  for I := 0 to 9 do
    if CheckBaud = BaudValues[I] then begin
      Bauds.ItemIndex := I;
      break;
    end;

    {Hardware flow}
  DTRRTS.Checked := hwfUseDTR in MainForm.ApdComPort1.HWFlowOptions;
  RTSCTS.Checked := hwfUseRTS in MainForm.ApdComPort1.HWFlowOptions;

    {Software flow}
  SoftwareXmit.Checked := (MainForm.ApdComPort1.SWFlowOptions = swfBoth) or
                          (MainForm.ApdComPort1.SWFlowOptions = swfTransmit);
  SoftwareRcv.Checked := (MainForm.ApdComPort1.SWFlowOptions = swfBoth) or
                         (MainForm.ApdComPort1.SWFlowOptions  = swfReceive);
  Edit1.Text := IntToStr(Ord(MainForm.ApdComPort1.XOnChar));
  Edit2.Text := IntToStr(Ord(MainForm.ApdComPort1.XOffChar));

  Paritys.ItemIndex := Ord(MainForm.ApdComPort1.Parity);
  Databits.ItemIndex := 8-MainForm.ApdComPort1.Databits;
  Stopbits.ItemIndex := Pred(MainForm.ApdComPort1.Stopbits);

      label3.Caption := IntToStr(MainForm.ApdComPort1.DataBits);

end;

Reply With Quote
  #10  
Old January 27th, 2004, 05:51 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,381 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 24 m 14 sec
Reputation Power: 4080
That's easy to do too. All you have to do is reverse the logic of PrepareDisplay. Assuming you have an Ok button in TPortSetupMain, something like this ought to do the trick:
Code:
procedure TPortSetupMain.OkButtonClick(Sender : TObject);
begin
    ProcessSettings;
    Close;
end;

procedure TPortSetupMain.ProcessSettings;
var
     parentform : TMainForm;
begin
     parentform := self.parent as TMainForm;
     parentform.ApdComPort1.XOnCharend := Edit1.Text;
     ...
end;


BTW I noticed in PrepareDisplay, you're referring to the mainform components as Mainform.ApdComPort1.xxx instead of parentform.ApdComPort1.xxx, even though you went to the trouble of assiging parentform and typecasting it correctly. Is there a good reason for this?

Reply With Quote
  #11  
Old January 27th, 2004, 05:57 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
That was a mistake and did throw up an hint in delphi so I deleted it. Should I leave it in? The form is actually called mainform.

Reply With Quote
  #12  
Old January 27th, 2004, 06:01 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,381 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 20 h 24 m 14 sec
Reputation Power: 4080
>> That was a mistake and did throw up an hint in delphi so I deleted it. Should I leave it in?
Only if you're using parentform to refer to the components on the main form. i.e. instead of doing this:
Code:
          Bauds.ItemIndex := 6;
  CheckBaud := MainForm.ApdComPort1.Baud div 10;

I would do this:
Code:
parentform := self.parent as TMainForm;
   Bauds.ItemIndex := 6;
  CheckBaud := parentform.ApdComPort1.Baud div 10;

Of course, to use the above, you would need to uncomment the //PortSetupMain.Parent := self; in TMainForm, so that the Parent is set up correctly. Your call here .

Reply With Quote
  #13  
Old January 27th, 2004, 06:06 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
I'll give it a go.

Reply With Quote
  #14  
Old January 27th, 2004, 06:33 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
Tried again. Same error as before.

Reply With Quote
  #15  
Old January 27th, 2004, 07:17 PM
lloydie-t lloydie-t is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2002
Location: UK
Posts: 563 lloydie-t User rank is Private First Class (20 - 50 Reputation Level)lloydie-t User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 23 h 54 m 22 sec
Reputation Power: 12
Sorry, the best I could do was:

Code:
procedure TPortSetupMain.ProcessSettings;

begin

     MainForm.ApdComPort1.Open := False;
     DelayTicks.Enabled := True;
  
     MainForm.ApdComPort1.Baud := LongInt(BaudValues[Bauds.ItemIndex]) * 10;

     MainForm.ApdComPort1.Open := True;
     DelayTicks.Enabled := False;
     end;


but it seem to work.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > Problem using Asyncpro AdxPort.pas form

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap