Jump to content
Developer Wiki and Function Reference Links ×

List box bloat!


Recommended Posts

Ok, whats up with this?

I make a list box and populate it with a fixed number of elements. When I click on one of the items in the box to make a selection, everything in the box (actually in all boxes) is duplicated. The box keeps growing every time I make a selection.

What is happening? How do I prevent it? And where can I find some examples of basic user interface stuff so I don't need to keep asking dumb questions?

{///////////////////////////////////////////////////////////////

Listbox Test

By: DAynardi

Built with Dialog Builder 4 © 2001 Nemetschek North America.

///////////////////////////////////////////////////////////////}

PROCEDURE Listboxt;

VAR

ln,dlogID,dlogResult, Nlayer : INTEGER;

dialogIsOK,rsrcOK : BOOLEAN;

Lh : Handle;

Layer : STRING;

Layerlist: DYNARRAY[]OF STRING;

{ dialog related subroutines }

{Load the list box}

PROCEDURE Layerload;

BEGIN

Ln:=1;

Lh:=LLayer;

Nlayer:=NumLayers;

ALLOCATE Layerlist[1..Nlayer];

REPEAT

Layer:=GetLName(Lh);

Layerlist[Ln]:=Layer;

Lh:=prevlayer(Lh);

INSERTCHOICE (4,0,Layer);

Ln:=Ln+1;

UNTIL (Lh=NIL);

END;

{ Dialog definition function subroutine }

FUNCTION Define_ListboxTest : INTEGER;

VAR

dialogID : INTEGER;

BEGIN

dialogID := CreateLayout('Untitled Dialog',True,'OK','Cancel');

CreateListBox(dialogID,4,25,25);

SetFirstLayoutItem(dialogID,4);

SetHelpString(1,'Accepts dialog data.');

SetHelpString(2,'Cancels operation without changes.');

SetHelpString(4,'A list box control.');

Define_ListboxTest := dialogID;

END;

{ Dialog driver function subroutine }

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

BEGIN

Layerload;

CASE item OF

SetupDialogC:BEGIN

END;

{ user selected OK button }

1:BEGIN

END;

{ user selected Cancel button }

2:BEGIN

END;

4:BEGIN

END;

END;

END;

{ main body of script }

BEGIN

dlogID := Define_ListboxTest;

dialogIsOK := VerifyLayout(dlogID);

IF dialogIsOK THEN BEGIN

dlogResult := RunLayoutDialog(dlogID,Drive_ListboxTest);

END;

END;

Run(ListboxT);

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