Jump to content
Developer Wiki and Function Reference Links ×

dialog and x,y


Recommended Posts

Hi,

Is there anyone who can help me with the following script. The VS-error wants a BEGIN instead of RUN.

It is a trialscript and doesn't have any meaning but it shows me what is possible.

thanks in advance,

Dirlep

Here it comes :

procedure MyDialog;

FUNCTION Define_MyDialog : INTEGER;

VAR

id: LONGINT;

BEGIN

id := CreateLayout('puntjes zetten',TRUE,'Doe maar', 'effe wachten');

CreateStaticText(id,4,'Geef X1:',-1);

CreateEditReal(id,5,4,0,10);

CreateStaticText(id,6,'Geef y1:',-1);

CreateEditReal(id,7,4,0,10);

SetFirstLayoutItem(id,4);

SetRightItem(id,4,5,0,0);

SetRightItem(id,5,6,0,0);

SetRightItem(id,6,7,0,0);

{ perform final control alignment and adjustment }

AlignItemEdge(id,4,1,1001,0);

AlignItemEdge(id,8,1,1001,0);

SetHelpString(1,'Voert het gevraagde uit.');

SetHelpString(2,'stop en sluit.');

SetHelpString(4,'beetje uitleg nodig?');

SetHelpString(5,'amaai.');

Define_MyDialog := id;

END;

PROCEDURE Drive_MyDialog(VAR item:LONGINT; data:LONGINT);

VAR

x,y,y1,x1:REAL;

id: LONGINT;

result : LONGINT;

BEGIN

DSelectAll;

GetPt(x, y); {bepaald het invoegpunt}

SetOrigin (x,y);

locus(x,y);

PushAttrs;

PenFore(255);

PenBack(0);

PenPat(2);

PenSize(14);

PenPat(2);

Marker(0, 0.125000, 15);

NameClass('beton sier');

Poly(1,0 , 0,1 ,0,12 ,x1,y1, 1,0 , 4,0 , 1,0 );

PopAttrs;

SetOriginAbsolute(0,0);

dselectall;

result := RunLayoutDialog(id,Drive_MyDialog);

END;

RUN(MyDialog);

Link to comment

Hi dirlep,

You need to call those two procedures from a MAIN body, which is missing. The following compiles, but does not run, because you do not have an event loop defined properly in your second procedure. I added your MAIN body in the following, but you'll have to add a CASE statement to the second procedure to trap the items being clicked. It is of the form:

code:

	case item of

SetupDialogC: begin end;

1: begin end; { OK }

2: begin end; { Cancel }

3: begin end; { your items }

end; { case }
[/code]

Your code should be part of one of the items in the CASE statement, possibly the OK button. You are about 90% done.

Raymond

code:

procedure MyDialog;

VAR

id, result :Integer;

FUNCTION Define_MyDialog : INTEGER;

VAR

id: LONGINT;

BEGIN

id := CreateLayout('puntjes zetten',TRUE,'Doe maar', 'effe wachten');

CreateStaticText(id,4,'Geef X1:',-1);

CreateEditReal(id,5,4,0,10);

CreateStaticText(id,6,'Geef y1:',-1);

CreateEditReal(id,7,4,0,10);

SetFirstLayoutItem(id,4);

SetRightItem(id,4,5,0,0);

SetRightItem(id,5,6,0,0);

SetRightItem(id,6,7,0,0);

{ perform final control alignment and adjustment }

AlignItemEdge(id,4,1,1001,0);

AlignItemEdge(id,8,1,1001,0);

SetHelpString(1,'Voert het gevraagde uit.');

SetHelpString(2,'stop en sluit.');

SetHelpString(4,'beetje uitleg nodig?');

SetHelpString(5,'amaai.');

Define_MyDialog := id;

END;

PROCEDURE Drive_MyDialog(VAR item:LONGINT; data:LONGINT);

VAR

x,y,y1,x1:REAL;

id: LONGINT;

result : LONGINT;

BEGIN

DSelectAll;

GetPt(x, y); {bepaald het invoegpunt}

SetOrigin (x,y);

locus(x,y);

PushAttrs;

PenFore(255);

PenBack(0);

PenPat(2);

PenSize(14);

PenPat(2);

Marker(0, 0.125000, 15);

NameClass('beton sier');

Poly(1,0 , 0,1 ,0,12 ,x1,y1, 1,0 , 4,0 , 1,0 );

PopAttrs;

SetOriginAbsolute(0,0);

dselectall;

END;

Begin

id := Define_MyDialog;

result := RunLayoutDialog(id, Drive_MyDialog);

End;

RUN(MyDialog);
[/code]

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...