Jump to content
Developer Wiki and Function Reference Links ×

modern dialog & selection


Recommended Posts

Hello,

I'm creating a dialog box that builds a group of check boxes and edittext boxes based on a known group of fields from a record.

I don't want to hard codes these items incase i add a new field in my record.

so far the script is working fine except....

i want the user to be able to select a check box

selecting this check box enables the edittext box associated with it and allows the user to enter or edit existing text.

this works fine until i call the 'SelectEditText(dialog1...) procedure.

the script get very confused and almost randomly chooses what it wants to and sometimes nothing at all

without this line the script works fine, but the you have to manually select the edittext box (don't like that, maybe just laziness on my end)

Does anyone know what may be going on here and how i can get this to work as described above?

Thanks in advance

Jeff Miller

VW10

partial code items

CONST

kStartProgStuff = start range of progmatic built items (21)

kmaxFields: = limit of range (20)

VAR

FieldNameArray = array of field name in the record

Dialog items created during run time

progEditText is an Edit tect box

progCheckBox is a check box

assignments to the checkbox & edit text

progEditText = kStartProgStuff

progCheckBox = kStartProgStuff + kmaxFields

PROCEDURE dialog1_Setup; (partial)

BEGIN

dialog1 := CreateResizableLayout(GetStr( 3), True, GetStr(kOK), GetStr(kCancel), TRUE, TRUE);

CreateGroupBox (dialog1, kGroupBox5, GetStr(kGroupBox5), True);

progCheckBox := kstartProgStuff;

progEditText := kstartProgStuff + kmaxFields;

{create the 1st check box and edit box for position)

CreateCheckBox (dialog1, progCheckBox, ' ', FieldNameArray[1]));

CreateEditText (dialog1, progEditText, ' ' , 30);

SetFirstGroupItem (dialog1, kGroupBox5, progCheckBox);

SetRightItem (dialog1, progCheckBox, progEditText, 10, 0);

{Create Check Boxes * Edit Text Fields for Each of the Fields in the Title Block}

FOR i := 1 TO fieldCount - 1 DO BEGIN

CreateCheckBox (dialog1, progCheckBox + i, FieldNameArray[i +1]));

CreateEditText (dialog1, progEditText + i , 30);

SetBelowItem (dialog1, progcheckBox + i -1 ,progCheckBox + i, 0,3 );

SetBelowItem (dialog1, progEditText + i -1, progEditText + i, 0, 0);

END;

END;

PROCEDURE dialog1_Handler(VAR item :LONGINT; data :LONGINT); (partial)

BEGIN

CASE item OF

SetupDialogC:

BEGIN

kstartProgStuff..kstartprogStuff + kmaxFields:

BEGIN

progCheckBox := kStartProgStuff;

progEditText := kstartProgStuff + kmaxFields;

FOR i := 0 to kMaxFields - 1 DO BEGIN

IF (ItemSel(progCheckBox + i)) THEN BEGIN

EnableItem(dialog1, progEditText +i, TRUE);

SelectEditText(dialog1, progEditText +i); <<<<<<<< ISSUE LINE works fine without this call >>>>>>>>

END;

END;

Link to comment
  • Vectorworks, Inc Employee

Jeff,

Without having the full code to run I'm just guessing but selecting an item creates an event and you are getting stuck in an endless loop selecting.

If you are going to do this you need to store the last event item and don't change the selection if the event is the same as the previous one.

Kevin

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