patric
Member-
Posts
10 -
Joined
-
Last visited
Reputation
0 Neutral-
Pull-down menu causes trouble by closing the menu window
patric replied to patric's topic in Vectorscript
every problem is solved! Thanks for the help! -
Pull-down menu causes trouble by closing the menu window
patric replied to patric's topic in Vectorscript
Thanks for the help, it might be, that the '1-3'-thing will solve all of the problems. 'choice is not stored' should have expressed that when I pressed the OK Button and did not select any item in the pull-down menu, the default string of the pull-down menu couldn't be accessed. It just gave the default integer. -
Hello again, another problem: I have written a little menu layout. The problem is: when I select an item of the pull-down menu the window of the menu closes. I want it to stay until I press 'OK' or 'cancel'. And in addition to that, the selected Choice is not stored when I press OK... Does anybody know a solution?
-
It's not so easy as it first seemed, but it's a great manual you wrote, Raymond. With this tool it's fun programming!
-
You search the code again and again and you won't find the mistake by yourself. And in the end it's so easy;) Thanks for the help!
-
Thanks Raymond! It seems there is a lot to do. I will try what you suggest. But do you think the problem with the negative coordinates will be solved? As you have proposed a similar script before did you have any problems like this?
-
Hi Pat, thanks for your help, it might be that the code is a little bit naive as I'm a VectorScript newbie and my c and java skills are a little bit rusty. - I checked it, but I thought, it would only change the y-coordinate. In fact I have an Array Of Handles which I want to sort by Arrays Of Real. So I tried the simplest way of using a bubble sort. I just want to sort about 300 symbols in one step, so slimming down the code is not the most important thing for this moment - 'l' is just a counter to make sure that every position in the array is checked every time. It's not the elegant but the easy way... There might be a mistake, but I don't get it. - could you give me an example? I tried something like that but the compiler gave back an exception. - Neither do I. When I move the symbols to positive coordinates, the whole things works fine. - I'm not sure what you mean ('using data structures')... I don't have the code in a nice and structured way to present. Sorry! Here are just parts of it. VAR h : ARRAY [1..1000] OF Handle; pX,pY : ARRAY [1..1000] OF Real; biggerY: HANDLE;{used in bubble sort to store data} i,j,k,l,m: Integer; CountSymI : Integer; CountSymStr : String; havetochange,checkX: Boolean;{used in Bubblesort} in the main program: {to store the selected objects in Handles} i:=1; h:=FSActLayer; While h<>NIL DO BEGIN h[i+1]:=NextSObj(h); i:=i+1; END; {to store the corresponding coordinates of the stored objects} j:=1; WHILE h[j] <> NIL DO BEGIN Get2DPt(h[j],1,pX[j],pY[j]); j:=j+1; END; {bubble sort} FOR l:=1 TO i-1 DO Begin FOR k:=1 TO i-1 DO Begin checkX:=FALSE; havetochange:=FALSE; Get2DPt(h[k],1,pX[k],pY[k]); Get2DPt(h[k+1],1,pX[k+1],pY[k+1]); IF (pY[k] IF (pY[k]=pY[k+1]) THEN checkX:=TRUE; IF (havetochange=TRUE) THEN biggerY:=h[k]; {ein simpler swap algorithmus} IF (havetochange=TRUE) THEN h[k]:=h[k+1]; IF (havetochange=TRUE) THEN h[k+1]:=biggerY; IF(checkX=TRUE)&(pX[k]>pX[k+1]) THEN biggerY:=h[k]; IF(checkX=TRUE)&(pX[k]>pX[k+1]) THEN h[k]:=h[k+1]; IF(checkX=TRUE)&(pX[k]>pX[k+1]) THEN h[k+1]:=biggerY; END; END; {writing the new handle number into the data base} CountsymI:=1; While h[CountsymI]<>NIL DO BEGIN CountSymStr:=NUM2Str(0,CountSymI);SetRField(h[CountsymI],'RechteckigeDB','Pultnr',CountSymStr); {changes the field 'pultnr' in the database 'RechteckigeDB'} CountSymI:=CountSymI+1; END; then of course END and RUN... I hope that you will understand the way I want it to work;-)
-
The Bubble Sort works fine, but I've got a problem swapping the handles: When the coordinate is negative the corresponding handle won't stored and I don't know why... The code is: FOR l:=1 TO i-1 DO Begin FOR k:=1 TO i-1 DO Begin checkX:=FALSE; havetochange:=FALSE; Get2DPt(h[k],1,pX[k],pY[k]); Get2DPt(h[k+1],1,pX[k+1],pY[k+1]); IF (pY[k] IF (pY[k]=pY[k+1]) THEN checkX:=TRUE; IF (havetochange=TRUE) THEN biggerY:=h[k]; IF (havetochange=TRUE) THEN h[k]:=h[k+1]; IF (havetochange=TRUE) THEN h[k+1]:=biggerY; IF(checkX=TRUE)&(pX[k]>pX[k+1]) THEN biggerY:=h[k]; IF(checkX=TRUE)&(pX[k]>pX[k+1]) THEN h[k]:=h[k+1]; IF(checkX=TRUE)&(pX[k]>pX[k+1]) THEN h[k+1]:=biggerY; END; END; Do you have any idea? I also tried to add greater numbers to the coordinates but then it does not even work for positive coordinates...
-
Thank you so much! That should solve the problem. So if I want the algorithm to sort from the upper left corner down to the lower right, I just have to implement the Bubblesort algorithm twice with a request like: IF y[i+1]=y (i=index of the handle array) THEN DO 'BUBBLESORT X-Coordinates' ? Patric
-
Hello, I have a very specific programming question: I would like to number selected Symbols just like the 'number instruments' tool which is implemented in spotlight. Therefore I have created an Array of Handles - 1 Handle for each selected symbol. Now I want to create an order to number these symbols. As variables I want to use x- and y-coordinates. So for the moment I have an Array of Handles or symbols (h) and (arrays of) x- and y-coordinates (x,y). Now I need an algorithm to sort the symbols by both of the coordinates, so I can number the symbols from top to bottom and/or left to right. It seems basic programming knowledge, but I cannot find an algorithm which sorts by two variables. For the moment I feel quite desperate, so please help me!!! Patric