Hi,
The Delphi version of the Lyr_Set procedure does not appear to work.
I have written a simple test macro which simply attempts to create a new layer and then set it as the active layer. The new layer is created ok, but it is not set as the active layer. Code of this test macro is below:
I don't think I am doing anything wrong? Can anybody offer advice on the use of Lyr_Set in D4D ?
The Delphi version of the Lyr_Set procedure does not appear to work.
I have written a simple test macro which simply attempts to create a new layer and then set it as the active layer. The new layer is created ok, but it is not set as the active layer. Code of this test macro is below:
Code: Select all
library LyrTest;
{$E dmx} // dmx is the extension for DCAL Dll's
{$R *.res}
uses
UConstants in 'C:\DataCAD 20\DCAL for Delphi\Header Files\UConstants.pas',
UInterfaces in 'C:\DataCAD 20\DCAL for Delphi\Header Files\UInterfaces.pas',
UInterfacesRecords in 'C:\DataCAD 20\DCAL for Delphi\Header Files\UInterfacesRecords.pas',
URecords in 'C:\DataCAD 20\DCAL for Delphi\Header Files\URecords.pas',
UVariables in 'C:\DataCAD 20\DCAL for Delphi\Header Files\UVariables.pas';
type
LyrTestL = record
state: asint;
LyrName : str255;
case byte of
0: (gete: getescarg);
1: (gets: DgetstrArg);
end;
PLyrTestL = ^LyrTestL;
function LyrTest_world_main(act: action; pl, pargs: Pointer): wantType;
var
retval: asint;
l: PLyrTestL;
addr : lyraddr;
begin
l := PLyrTestL(pl);
if act = aagain then begin
case l^.state of
1: case l^.gete.key of
f1: l^.state := 2;
s0: l^.state := 0;
end;
2: begin
wrtmsg('');
if l^.gets.Result = res_normal then begin
lyr_create (l^.LyrName, addr);
lyr_set (addr);
end;
l^.state := 1;
end;
else l^.state := 0;
end;
end;
if act = Afirst then
l^.state := 1
else if act = AlSize then
SetLocalSize(sizeof(l^));
if act <> AlSize then begin
case l^.state of
1: begin
wrtlvl('LyrTest');
lblsinit;
lblset(1, 'New Layer', 'Create new layer and set it as active');
lblset(20, 'Exit');
lblson;
getesc(l^.gete, retval);
end;
2: begin
lblsinit;
lblson;
wrtmsg('Layer Name: ', true);
callDGetstr255(l^.LyrName, 70, l^.gets, retval);
end;
else retval := XDone;
end;
end;
Result := retval;
end;
function Main(dcalstate: asint; act: action; pl, pargs: Pointer): wantType; stdcall;
begin
case dcalstate of
XDcalStateBegin: Result := LyrTest_world_main(act, pl, pargs);
else Result := XDone;
end;
end;
exports
Main;
begin
end.
I don't think I am doing anything wrong? Can anybody offer advice on the use of Lyr_Set in D4D ?
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD