
! script name: vitems.d/deleteitem
! var_topic: delete an item flag

!A
!A NAME:
!A
!A 	Delete Item
!A
!A DESCRIPTION:
!A
!A      This script deletes an item flag and its associated geometry,
!A 	removing it from VDM.
!A
!# see also - htdocs/help.d/items.htm
!# see also - htdocs/help.d/property.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: delete item")

DIM Destination$[512]
DIM Answer$[512]
DIM A$[512]
DIM B$[512]
DIM Name$[512]
DIM Element$[512]
DIM Prop_name$[512]
DIM Prop_class$[512]
DIM Class_name$[512]
DIM Data$[32000]
DIM D_label$[512]
DIM Sub_label$[512]
DIM F_label$[512]
DIM Choice$[512]
DIM Ques$[512]

Var_object=CheckVarObject
IF ExitScript(Destination$) THEN Leave


DeActivateUndo
Start:!
Existing_props:!
Group1= GrpOfUserItems
Group= DependentSubGroup(Group1)
Stat= DeleteEntity(Group1)
IF NOT GroupCount(Group) THEN Leave
Stat=UserSelectBox("EXISTING ITEMS","Item selected",0,WsPropGroupSelect,Group)

Pick_prop:!
Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT ID NAME",Name$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Name$
CASE "CANCEL"
	Stat= DeleteEntity(Group)
	GOTO Leave
END SELECT

Num1= NumericPrefix(Name$)
IF NOT Num1 THEN Pick_prop
Prop_ent= GroupElement(Group,Num1)
IF NOT ValidDependency(Prop_ent) THEN Start
Stat= EntityNameCheck(Prop_ent,Prop_name$)
Stat= DeleteEntity(Group)
LowerSelectBox

Make_record:!
RecordFunctionOn
Stat=RecordDescr("DELETE ITEM:"&Prop_name$)
Stat= DeleteItem(Prop_name$)
RecordFunctionOff
CloseVarRecord

GOTO Start

Leave:!
LowerSelectBox
Stat=DeleteEntity(Group)
Stat=SetInputFormat("n4","")
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END

