Jump to content

Edit record field value script wish


Recommended Posts

I am looking for a script that gives the user the ability to edit record fields values via a pop-up windows (click to select object) where the user can tab thru the fields to change the values. The script would be active until cancelled by the user.

Since an object or symbol can have more than one record attached to it, the ideal script would have a second option in the mode bar, which would bring up all the existing records in the drawing and the user can choose the default editing record for thescript.

I use my own record formats for door/window schedules, TBs and I currently use the OIP/data tab, but such a tool would make record field value editing a breeze.

Another flavor of this script would have the option to select all objects or symbols with the default record format and bring up the editing window for each one regardless of thelayer/class visibility. This option would list the object/symbol - layer/class info as a reminder to the user. An example use of this script is when one does not start with a template that includes title blocks, and these have to be inserted manually and the record field value has to be edited for each instance.

Is this achievable with VS, does anybody have it, is willing to share it or sell it.

Link to comment

George,

Here's something written a while back that can be modified to fit your needs. Select the object and either add or edit the record attached. Add this as a menu plug-in item and give it a try. It should give you the idea on how it can be done in VS.

Dave

Procedure EditAddObjRec;{* Created by Dave Fugiel 2/13/99*}LABEL 10,99;

CONST kRec = 'Nimlok DB';

VAR Abort, Mac , yes : BOOLEAN; x , y : REAL; STR1 , STR2 , STR3 , STR4 , STR5 , STR6 , STR7 , STR8 : STRING; RF1, RF2 , RF3 , RF4 , RF5 , RF6 , RF7 , RF8 :STRING; Obhd , CustomObj : HANDLE; ObjectCount : LONGINT; ObjTyp : INTEGER; Recordhand,h ,RecordExist : HANDLE;

Procedure AddtheRecord;BEGIN Recordhand:=GetObject(kRec); RecordExist := GetRecord(Obhd,1);

IF Recordhand = Nil THEN BEGIN NewField(kRec, 'Code' , '',4,1); NewField(kRec, 'Description' , '',4,1); NewField(kRec, 'Price' ,'',6,2); NewField(kRec, 'Weight' , '',6,2); NewField(kRec, 'Rentable' , '',4,1); NewField(kRec,'WSR No','',6,0); NewField(kRec,'Pack No','',6,0); NewField(kRec,'Obj Type','',6,0);END;END; Procedure TheDialog;VAR Width,x1,y1,x2,y2,px1,px2,px3,px4,py1,py2,py3,py4 : INTEGER;

Procedure AlignScr ( Height, Width : INTEGER; VAR x1, x2, y1 : INTEGER );VAR scrx1, scry1, scrx2, scry2 : INTEGER;

BEGIN GetScreen ( scrx1, scry1, scrx2, scry2 ); x1 := ( ( scrx1 + scrx2 ) DIV 2 ) - ( Width DIV 2 ); x2 := x1 + Width; y1 := ( scry2 - scry1 - Height ) DIV 3;END;

Procedure LocateButtons ( DialogType, scnh, scnw : INTEGER );VAR v1, v2, v3, v4 : INTEGER;

Procedure Swap ( VAR m1, m2, m3, m4 : INTEGER );VAR Temp : INTEGER;

BEGIN Temp := m1; m1 := m3; m3 := Temp; Temp := m2; m2 := m4; m4 := Temp;END; { of Swap }

BEGIN GetVersion ( v1, v2, v3, v4 ); Mac := ( v4 = 1 );

IF DialogType = 1 THEN BEGIN px1 := ( scnw DIV 2 ) - 80; px2 := ( scnw DIV 2 ) - 10; px3 := ( scnw DIV 2 ) + 10; px4 := ( scnw DIV 2 ) + 80; IF Mac THEN SWAP ( px1, px2, px3, px4 );

py1 := scnh - 40; py2 := scnh - 20; py3 := py1; py4 := py2; END

ELSE IF DialogType = 2 THEN BEGIN px1 := scnw - 180; px2 := scnw - 110; px3 := scnw - 90; px4 := scnw - 20; IF Mac THEN SWAP ( px1, px2, px3, px4 );

py1 := scnh - 40; py2 := scnh - 20; py3 := py1; py4 := py2; END

ELSE BEGIN px1 := scnw - 90; px2 := scnw - 20; px3 := px1; px4 := px2;

py1 := scnh -70; py2 := scnh - 50; py3 := scnh - 40; py4 := scnh - 20; IF Mac THEN SWAP ( py1, py2, py3, py4 ); END;END; { of Locate Buttons }

Procedure MakeDialog;CONST scnh = 335; scnw = 320; DialogType = 3;

BEGIN AlignScr ( scnh, scnw, x1, x2, y1); y2 := y1 + scnh; LocateButtons ( DialogType, scnh, scnw );

BeginDialog ( 1, 1, x1, y1, x2, y2 ); AddButton ( 'OK', 1, 1, px1, py1, px2, py2 ); AddButton ( 'Cancel', 2, 1, px3, py3, px4, py4 ); AddField ( 'Code:' , 3, 1, 10, 20 , 85, 35 ); AddField ( '' ,4, 2, 95, 20 , 305, 35 ); AddField ( 'Description:' , 5, 1, 10, 50 , 85, 65 ); AddField ( '' ,6, 2, 95, 50 , 305, 65 ); AddField ( 'Price:' , 7, 1, 10, 80 , 85, 95 ); AddField ( '' ,8, 2, 95, 80 , 305, 95 ); AddField ( 'Weight:' , 9, 1, 10, 110 , 85, 125 ); AddField ( '' ,10, 2, 95, 110 , 305, 125 ); AddField ( 'Rentable:' , 11, 1, 10, 140 , 85, 155 ); AddField ( '' ,12, 2, 95, 140 , 305, 155 ); AddField ( 'WSR No:' , 13, 1, 10, 170 , 85, 185 ); AddField ( '' ,14, 2, 95, 170 , 305, 185 ); AddField ( 'Pack No:' , 15, 1, 10, 200 , 85, 215 ); AddField ( '' ,16, 2, 95, 200 , 305, 215 ); AddField ( 'Obj Type:' , 17, 1, 10, 230 , 85, 245 ); AddField ( '' ,18, 2, 95, 230 , 305, 245 ); EndDialog;END;

BEGIN MakeDialog;END;

Procedure GetInfo;LABEL 10 , 99;

VAR item : INTEGER; Done , OK : BOOLEAN;

BEGIN Done := FALSE; Abort := FALSE; RF1 := ''; RF2 := ''; RF3 := ''; RF4 := ''; RF5 := ''; RF6 := ''; RF7 := ''; RF8 := ''; Obhd := LSActLayer; IF Obhd <> NIL THENBEGINAddtheRecord;

RF1 := EvalStr ( Obhd , ('Nimlok DB'.'Code'));RF2 := EvalStr ( Obhd , ('Nimlok DB'.'Description'));RF3 := EvalStr ( Obhd , ('Nimlok DB'.'Price'));RF4 := EvalStr ( Obhd , ('Nimlok DB'.'Weight'));RF5 := EvalStr ( Obhd , ('Nimlok DB'.'Rentable'));RF6 := EvalStr ( Obhd , ('Nimlok DB'.'WSR No'));RF7 := EvalStr ( Obhd , ('Nimlok DB'.'Pack No'));RF8 := EvalStr ( Obhd , ('Nimlok DB'.'Obj Type'));END;

GetDialog ( 1 ); SetTitle ( 'Edit/ Add Record Info' ); SelField ( 4 ); SetField ( 4, RF1 ); SetField ( 6, RF2 ); SetField ( 8, RF3 ); SetField ( 10, RF4 ); SetField ( 12, RF5 ); SetField ( 14, RF6 ); SetField ( 16, RF7 ); SetField ( 18, RF8 ); 10:REPEAT DialogEvent ( Item ); CASE item OF 1 : Done := True;

2 : BEGIN Done := TRUE; Abort := TRUE; END; END; { of CASE }UNTIL Done; IF Abort THEN GOTO 99; STR1 := GetField ( 4 ); STR2 := GetField ( 6 ); STR3 := GetField ( 8 ); STR4 := GetField ( 10 ); STR5 := GetField ( 12 ); STR6 := GetField ( 14 ); STR7 := GetField ( 16 ); STR8 := GetField ( 18 ); 99 : ClrDialog; END; PROCEDURE ObjFrom;BEGIN

IF Obhd <> NIL THEN CustomObj := Obhd ELSE CustomObj := LNewObj; END;

Procedure AddRecordInfo; BEGIN ObjFrom; SetRecord ( CustomObj ,'Nimlok DB' ); SetRField ( CustomObj ,'Nimlok DB','Code',STR1 ); SetRField ( CustomObj ,'Nimlok DB','Description', STR2 ); SetRField ( CustomObj , 'Nimlok DB' , 'Price' , STR3 );

SetRField ( CustomObj , 'Nimlok DB' , 'Weight' , STR4 ); SetRField ( CustomObj , 'Nimlok DB' , 'Rentable' , STR5 ); SetRField ( CustomObj , 'Nimlok DB' , 'WSR No' , STR6 ); SetRField ( CustomObj , 'Nimlok DB' , 'Pack No' , STR7 ); SetRField ( CustomObj , 'Nimlok DB' , 'Obj Type' ,STR8 ); END; BEGIN ObjTyp := GetType ( LSActLayer );

IF LSActlayer = NIL THEN BEGINSysbeep; AlrtDialog ( 'Select something to edit first knuckle head!' ); GOTO 99; END;

ObjectCount := Count ( ( SEL = TRUE ) ); IF ( ObjectCount > 1) & ( ObjTyp <> 11 ) THEN BEGIN Sysbeep; AlrtDialog ( 'Sorry, You have more than one object selected, Select only one!' ); GOTO 99; END;

TheDialog; GetInfo; IF Abort THEN GOTO 99;AddRecordInfo;99 : END;Run ( EditAddObjRec );

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...