Jump to content

EduardoS

Member
  • Posts

    29
  • Joined

  • Last visited

Reputation

0 Neutral

Personal Information

  • Location
    Afghanistan

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I don't know if it can be usefull to someone, but I'm sharing a script to make a custom grid. Forgive me if I mismatched some translation to english. I just couldn't place the fill box for space/lenght at it's right and properly aligned to its bottom, placed it under. Guess is due it is a swap pane. PROCEDURE CustomGrid; VAR DH, LH, PH, QH, DV, LV, PV, QV, LM, PM :INTEGER; DisH, LarH, ProH, Quah, DisV, LarV, ProV, QuaV, LarM, ProM :INTEGER; ALT, LAR, EH, EV, Un0, Un1, pX, pY :REAL; EC, ROh, ROv, TM :BOOLEAN; h1, h2, h3 : HANDLE; id :LONGINT; PROCEDURE Dialog_Setup; BEGIN id:=CreateLayout('Custom Grid',FALSE,'OK','Cancel'); CreateStaticText(id, 4,'Space Between or Lenght of Bars?',50); SetFirstLayoutItem(id, 4); CreateGroupBox(id, 10,'RB 1',FALSE); SetBelowItem(id, 4, 10, 0, 0); CreateRadioButton(id, 11,'Space'); SetFirstGroupItem(id, 10, 11); CreateRadioButton(id, 12,'Lenght'); SetBelowItem(id, 11, 12, 0, 0); CreateGroupBox(id, 5,'Horizontal Bars:',TRUE); SetBelowItem(id, 10, 5, 0, 0); CreateSwapControl (id, 20); SetFirstGroupItem(id, 5, 20); CreateGroupBox (id, 21, 'SP 1', FALSE); CreateStaticText(id, 22,'Space:',15); SetFirstGroupItem(id, 21, 22); CreateGroupBox (id, 23, 'SP 2', FALSE); CreateStaticText(id, 24,'Lenght:',15); SetFirstGroupItem(id, 23, 24); CreateSwapPane (id, 20, 21); CreateSwapPane (id, 20, 23); CreateEditInteger(id, 25, 0, 6); SetBelowItem(id, 21, 25, 0, 0); CreateStaticText(id, 51,'Thickness:',13); SetBelowItem(id, 20, 51, 0, 0); CreateEditInteger(id, 52, 0, 6); SetRightItem(id, 51, 52, 0, 0); CreateStaticText(id, 53,'Depth:',13); SetBelowItem(id, 51, 53, 0, 0); CreateEditInteger(id, 54, 0, 6); SetRightItem(id, 53, 54, 0, 0); CreateStaticText(id, 55,'N of Bars:',13); SetBelowItem(id, 53, 55, 0, 0); CreateEditInteger(id, 56, 0, 6); SetRightItem(id, 55, 56, 0, 0); CreateRadioButton (id, 57,'Retangle Profile'); SetBelowItem (id, 55, 57, 0, 0); CreateRadioButton (id, 58,'Oval Profile'); SetBelowItem (id, 57, 58, 0, 0); AlignItemEdge (id, 56, 1, 1, 0); AlignItemEdge (id, 25, 1, 1, 1); SetEdgeBinding (id, 25, TRUE, TRUE, FALSE, FALSE ); CreateGroupBox(id, 6,'Vertical Bars:',TRUE); SetRightItem(id, 5, 6, 0, 0); CreateSwapControl (id, 30); SetFirstGroupItem(id, 6, 30); CreateGroupBox (id, 31, 'SP 1', FALSE); CreateStaticText(id, 32,'Space:',15); SetFirstGroupItem(id, 31, 32); CreateGroupBox (id, 33, 'SP 2', FALSE); CreateStaticText(id, 34,'Lenght:',15); SetFirstGroupItem(id, 33, 34); CreateSwapPane (id, 30, 31); CreateSwapPane (id, 30, 33); CreateEditInteger(id, 35, 0, 6); SetBelowItem(id, 31, 35, 0, 0); CreateStaticText(id, 61,'Thickness:',13); SetBelowItem(id, 30, 61, 0, 0); CreateEditInteger(id, 62, 0, 6); SetRightItem(id, 61, 62, 0, 0); CreateStaticText(id, 63,'Depth:',13); SetBelowItem(id, 61, 63, 0, 0); CreateEditInteger(id, 64, 0, 6); SetRightItem(id, 63, 64, 0, 0); CreateStaticText(id, 65,'N of Bars:',13); SetBelowItem(id, 63, 65, 0, 0); CreateEditInteger(id, 66, 0, 6); SetRightItem(id, 65, 66, 0, 0); CreateRadioButton (id, 67,'Retangle Profile'); SetBelowItem (id, 65, 67, 0, 0); CreateRadioButton (id, 68,'Oval Profile'); SetBelowItem (id, 67, 68, 0, 0); AlignItemEdge (id, 66, 1, 2, 0); AlignItemEdge (id, 35, 1, 2, 1); SetEdgeBinding (id, 35, TRUE, TRUE, FALSE, FALSE ); CreateCheckBoxGroupBox(id, 7,'Has Frame?',FALSE); SetBelowItem(id, 5, 7, 0, 0); CreateStaticText(id, 40,'Thickness:',13); SetFirstGroupItem(id, 7, 40); CreateEditInteger(id, 41, 0, 6); SetRightItem(id, 40, 41, 0, 0); CreateStaticText(id, 42,'Depth:',13); SetRightItem(id, 41, 42, 0, 0); CreateEditInteger(id, 43, 0, 6); SetRightItem(id, 42, 43, 0, 0); AlignItemEdge (id, 51, 3, 3, 0); AlignItemEdge (id, 40, 3, 3, 1); SetEdgeBinding (id, 40, TRUE, TRUE, FALSE, FALSE ); AlignItemEdge (id, 52, 3, 4, 0); AlignItemEdge (id, 41, 3, 4, 1); SetEdgeBinding (id, 41, TRUE, TRUE, FALSE, FALSE ); AlignItemEdge (id, 61, 3, 5, 0); AlignItemEdge (id, 42, 3, 5, 1); SetEdgeBinding (id, 42, TRUE, TRUE, FALSE, FALSE ); AlignItemEdge (id, 62, 3, 6, 0); AlignItemEdge (id, 43, 3, 6, 1); SetEdgeBinding (id, 43, TRUE, TRUE, FALSE, FALSE ); CreateStaticText(id, 8,'After the OK, Click Where to Place it.',50); SetBelowItem(id, 7, 8, 0, 0); END; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN END; 1: BEGIN GetBooleanItem(id, 11, EC); IF GetEditInteger(id,25,DisH) AND GetEditInteger(id,52,LarH) AND GetEditInteger(id,54,ProH) AND GetEditInteger(id,56,QuaH) THEN DH:= DisH; LH:= LarH; PH:= ProH; QH:= QuaH; GetBooleanItem(id, 57, ROh); IF GetEditInteger(id,35,DisV) AND GetEditInteger(id,62,LarV) AND GetEditInteger(id,64,ProV) AND GetEditInteger(id,66,QuaV) THEN DV:= DisV; LV:= LarV; PV:= ProV; QV:= QuaV; GetBooleanItem(id, 67, ROv); GetBooleanItem(id, 7, TM); IF TM THEN BEGIN IF GetEditInteger(id,41,LarM) AND GetEditInteger(id,43,ProM) THEN LM:= LarM; PM:= ProM END; END; 11: BEGIN DisplaySwapPane(id, 20, 1); DisplaySwapPane(id, 30, 1); END; 12: BEGIN DisplaySwapPane(id, 20, 2); DisplaySwapPane(id, 30, 2); END; END; END; BEGIN Dialog_Setup; IF RunLayoutDialog (id, Dialog_Handler) = 1 THEN BEGIN GetPt(pX, pY); BeginGroup; IF EC THEN BEGIN ALT:=DH*(QH+1)+QH*LH; LAR:=DV*(QV+1)+QV*LV; EH:=DH; EV:=DV; END ELSE BEGIN LAR:=DH; ALT:=DV; EH:=(DV-QH*LH)/(QH+1); EV:=(DH-QV*LV)/(QV+1); END; IF ROh THEN BEGIN Un0:=pX-ALT/2+EH; Un1:=pX+ALT/2-EH; BeginXtrd(-LAR/2, LAR/2); REPEAT Rect(Un0,pY-PH/2,Un0+LH,pY+PH/2); Un0:=Un0+LH+EH; UNTIL(Un0>Un1); EndXtrd; h1:= LNewObj; Set3DRot(h1, 0, 90, 0, pX, pY, 0); Move3D(0, 0, ALT/2); END ELSE BEGIN Un0:=pX-ALT/2+EH; Un1:=pX+ALT/2-EH; BeginXtrd(-LAR/2, LAR/2); REPEAT Oval(Un0,pY-PH/2,Un0+LH,pY+PH/2); Un0:=Un0+LH+EH; UNTIL(Un0>Un1); EndXtrd; h2:= LNewObj; Set3DRot(h2, 0, 90, 0, pX, pY, 0); Move3D(0, 0, ALT/2); END; IF ROv THEN BEGIN Un0:=pX-LAR/2+EV; Un1:=pX+LAR/2-EV; BeginXtrd(0, ALT); REPEAT Rect(Un0,pY-PH/2,Un0+LV,pY+PH/2); Un0:=Un0+LV+EV; UNTIL(Un0>Un1); EndXtrd; END ELSE BEGIN Un0:=pX-LAR/2+EV; Un1:=pX+LAR/2-EV; BeginXtrd(0, ALT); REPEAT Oval(Un0,pY-PH/2,Un0+LV,pY+PH/2); Un0:=Un0+LV+EV; UNTIL(Un0>Un1); EndXtrd; END; IF TM THEN BEGIN BeginXtrd(-LAR/2, LAR/2); Rect(pX-ALT/2-LM,pY-PM/2,pX-ALT/2,pY+PM/2); Rect(pX+ALT/2,pY-PM/2,pX+ALT/2+LM,pY+PM/2); EndXtrd; h3:= LNewObj; Set3DRot(h3, 0, 90, 0, pX, pY, 0); Move3D(0, 0, ALT/2); BeginXtrd(-LM, ALT+LM); Rect(pX-LAR/2-LM,pY-PM/2,pX-LAR/2,pY+PM/2); Rect(pX+LAR/2,pY-PM/2,pX+LAR/2+LM,pY+PM/2); EndXtrd; END; EndGroup; END; END; RUN (CustomGrid);
  2. Trying to control the swap panes through Radio Buttons the same happened, can't manage the panes to swap. It seams I doing what says in the Vector Works Function Reference. http://developer.vectorworks.net/index.php/VS:DisplaySwapPane Any ideas? Here is what I did: PROCEDURE EsteScript; VAR EouT :BOOLEAN; id :LONGINT; PROCEDURE Dialog_Setup; BEGIN id := CreateLayout('Swap Pane Test', FALSE, 'OK', 'Cancel'); CreateStaticText(id, 4,'Espaço ou Tamanho?',50); SetFirstLayoutItem(id, 4); CreateGroupBox(id, 10,'RB 1',FALSE); SetBelowItem(id, 4, 10, 0, 0); CreateRadioButton(id, 11, 'Espaço'); SetFirstGroupItem(id, 10, 11); CreateRadioButton(id, 12, 'Tamanho'); SetBelowItem(id, 11, 12, 0, 0); CreateGroupBox(id, 20,'Os Panes',FALSE); SetBelowItem(id, 10, 20, 0, 0); CreateSwapControl (id, 21); SetFirstGroupItem (id, 20, 21); CreateGroupBox (id, 50, 'Pane E', TRUE); CreateStaticText(id, 51,'Espaço',8); SetFirstGroupItem (id, 50, 51); CreateGroupBox (id, 100, 'Pane T', TRUE); CreateStaticText(id, 101,'Tamanho',8); SetFirstGroupItem (id, 100, 101); CreateSwapPane (id, 21, 50); CreateSwapPane (id, 21, 100); END; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN GetBooleanItem(id, 11, EouT); IF EouT THEN BEGIN DisplaySwapPane (id, 21, 1); END ELSE BEGIN DisplaySwapPane (id, 21, 2); END; END; END; END; BEGIN Dialog_Setup; IF RunLayoutDialog (id, Dialog_Handler) = 1 THEN BEGIN END; END; RUN (EsteScript);
  3. JBenghiat, after posting this I figured out the 4 instead of 5... Fixed it, but it still does not swap panes.
  4. Hi all, I'm testing Swap Panes, just an exercise. I can't manage the panes to swap. What I am missing or doing wrong? TIA PROCEDURE EsteScript; VAR id :INTEGER; PROCEDURE Dialog_Setup; BEGIN id := CreateLayout('Testando Swap Pane', FALSE, 'OK', 'Cancel'); CreateStaticText(id, 4,'Espaço ou Tamanho?',20); SetFirstLayoutItem(id, 4); CreatePulldownMenu (id, 5, 17); SetBelowItem (id, 4, 5, 0, 0); CreateGroupBox (id, 6, 'Os Panes', TRUE); SetBelowItem (id, 5, 6, 0, 0); CreateSwapControl (id, 7); SetFirstGroupItem (id, 6, 7); CreateGroupBox (id, 10, 'Pane 1', TRUE); CreateStaticText(id, 11,'Espaço',8); SetFirstGroupItem (id, 10, 11); CreateGroupBox (id, 100, 'Pane 2', TRUE); CreateStaticText(id, 101,'Tamanho',8); SetFirstGroupItem (id, 100, 101); CreateSwapPane (id, 7, 10); CreateSwapPane (id, 7, 100); END; PROCEDURE Dialog_Handler (VAR item :LONGINT; data :LONGINT); VAR i : INTEGER; s1 : STRING; BEGIN CASE item OF SetupDialogC: BEGIN AddChoice (id, 5, 'Espaço', 0); AddChoice (id, 5, 'Tamanho',0); END; 1: BEGIN END; 4: BEGIN GetSelectedChoiceInfo (id, 5, 0, i, s1); DisplaySwapPane (id, 7, 1); END; END; END; BEGIN Dialog_Setup; IF RunLayoutDialog (id, Dialog_Handler) = 1 THEN BEGIN END; END; RUN(EsteScript);
  5. Raymond, I would like to thank you very much. All your answers gave me a guidance.
  6. Raymond, I did it! At least it works. Here is it: PROCEDURE EsteScript; VAR ESP, TAM, ALT, LAR :INTEGER; pX, pY :REAL; EouT, RouO, Boo :BOOLEAN; id, result :LONGINT; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN END; 1: BEGIN GetBooleanItem(id, 5, EouT); IF EouT THEN BEGIN Boo:= GetEditInteger(id,6,ESP); END ELSE BEGIN Boo:= GetEditInteger(id,8,TAM); END; GetBooleanItem(id, 10, RouO); IF RouO THEN BEGIN Boo:= GetEditInteger(id,12,ALT); Boo:= GetEditInteger(id,14,LAR); END ELSE BEGIN Boo:= GetEditInteger(id,17,ALT); Boo:= GetEditInteger(id,19,LAR); END; END; 2: BEGIN END; END; END; BEGIN id:=CreateLayout('Teste',FALSE,'OK','Cancel'); CreateGroupBox(id,4,'Espaçamento ou Tamanho',True); SetFirstLayoutItem(id, 4); CreateRadioButtonGroupBox(id,5,'Espaçamento',TRUE); SetFirstGroupItem(id, 4, 5); CreateEditInteger(id,6,0,6); SetFirstGroupItem(id, 5, 6); CreateRadioButtonGroupBox(id,7,'Tamanho',TRUE); SetRightItem(id,5,7,0,0); CreateEditInteger(id,8,0,6); SetFirstGroupItem(id, 7, 8); CreateGroupBox(id,9,'Retângulo ou Oval',TRUE); SetBelowItem(id, 4, 9, 0, 0); CreateRadioButtonGroupBox(id,10,'Retângulo',TRUE); SetFirstGroupItem(id, 9, 10); CreateStaticText(id,11,'Altura:',8); SetFirstGroupItem(id, 10, 11); CreateEditInteger(id,12,0,6); SetRightItem(id,11,12,0,0); CreateStaticText(id,13,'Largura:',8); SetBelowItem(id, 11, 13, 0, 0); CreateEditInteger(id,14,0,6); SetRightItem(id,13,14,0,0); CreateRadioButtonGroupBox(id,15,'Oval',TRUE); SetRightItem(id,10,15,0,0); CreateStaticText(id,16,'Altura:',8); SetFirstGroupItem(id, 15, 16); CreateEditInteger(id,17,0,6); SetRightItem(id,16,17,0,0); CreateStaticText(id,18,'Largura:',8); SetBelowItem(id, 16, 18, 0, 0); CreateEditInteger(id,19,0,6); SetRightItem(id,18,19,0,0); result:=RunLayoutDialog(id,Dialog_Handler); IF result = 1 THEN BEGIN GetPt(pX, pY); IF EouT THEN BEGIN IF RouO THEN BEGIN Rect(pX-LAR-ESP/2, pY-ALT/2, pX-ESP/2, pY+ALT/2); Rect(pX+ESP/2, pY-ALT/2, pX+LAR+ESP/2, pY+ALT/2); END ELSE BEGIN Oval(pX-LAR-ESP/2, pY-ALT/2, pX-ESP/2, pY+ALT/2); Oval(pX+ESP/2, pY-ALT/2, pX+LAR+ESP/2, pY+ALT/2); END END ELSE BEGIN IF RouO THEN BEGIN Rect(pX-TAM/2, pY-ALT/2, pX-TAM/2+LAR, pY+ALT/2); Rect(pX+TAM/2-LAR, pY-ALT/2, pX+TAM/2, pY+ALT/2); END ELSE BEGIN Oval(pX-TAM/2, pY-ALT/2, pX-TAM/2+LAR, pY+ALT/2); Oval(pX+TAM/2-LAR, pY-ALT/2, pX+TAM/2, pY+ALT/2); END END; END; END; RUN (EsteScript);
  7. Raymond, I'm just studying. What I'm trying is to draw 2 rectangles or 2 ovals. And I want to control the distance between them or the distance they are in. So I will have formulas like Rect or Oval(pX-LAR-ESP/2, pY-ALT/2, pX-ESP/2, pY+ALT/2); Rect or Oval(pX+ESP/2, pY-ALT/2, pX+LAR+ESP/2, pY+ALT/2); Or Rect or Oval(pX-TAM/2, pY-ALT/2, pX-TAM/2+LAR, pY+ALT/2); Rect or Oval(pX+TAM/2-LAR, pY-ALT/2, pX+TAM/2, pY+ALT/2); Is it possible to do? TIA Eduardo
  8. Raymond, in this exemple there are groups of 4 Radio Button, how to handle them? With 2 if one is selected the other is not, with 4 each of them has to be checked with GetBooleanItem(id, this RB id, This Boolean); if it is true then do something? And how to retrieve data from the RB's 1, 7, A and H presuming they have an input data (an edit integer) to use them in some calculation?
  9. I have another question Raymond. If I am working with Radio Buttons in Tabs how I control them? Got to check which TAB is selected an which Radio Button in that TAB is selected? Something like: 1: BEGIN {ok button} GetBooleanItem(id, This TAB, TAB_1); IF TAB_1 THEN BEGIN {Left TAB is selected} GetBooleanItem(id, This Radio Button, RB_1); IF RB_1 THEN BEGIN {One Radio Button in this TAB is selected} Boolean:= GetEditInteger(This Field data input); Boolean:= GetEditInteger(This Field data input); END ELSE BEGIN {Use the other Radio Button in this TAB} Boolean:= GetEditInteger(This Field data input); Boolean:= GetEditInteger(This Field data input); END END ELSE BEGIN {Use the Right TAB} GetBooleanItem(id, This Radio Button, RB_1); IF RB_1 THEN BEGIN {One Radio Button in this TAB is selected} Boolean:= GetEditInteger(This Field data input); Boolean:= GetEditInteger(This Field data input); END ELSE BEGIN {Use the other Radio Button in this TAB} Boolean:= GetEditInteger(This Field data input); Boolean:= GetEditInteger(This Field data input); END END END; AND?
  10. Tanks a lot Raymond. That enlightened me a lot. Got to put in practice now.
  11. I need more help, if someone can assist me. Going further I was trying whit radio boxes to draw a rectangle or an oval at the mouse ckick, but I can't make it work. That is what I am doing, what is wrong or missing? PROCEDURE EsteScript; VAR ALT, LAR, AltR, LarR, AltO, LarO :INTEGER; pX, pY :REAL; id, result :LONGINT; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN END; 1: BEGIN IF GetEditInteger(id,6,AltR) AND GetEditInteger(id,8,LarR) THEN ALT:=AltR; LAR:=LarR; IF GetEditInteger(id,11,AltO) AND GetEditInteger(id,13,LarO) THEN ALT:=AltO; LAR:=LarO; END; 2: BEGIN END; END; END; BEGIN id:=CreateLayout('Retângulo ou Oval',FALSE,'OK','Cancel'); CreateRadioButtonGroupBox(id,4,'Retângulo',TRUE); SetFirstLayoutItem(id, 4); CreateStaticText(id,5,'Altura:',8); SetFirstGroupItem(id, 4, 5); CreateEditInteger(id,6,0,6); SetRightItem(id,5,6,0,0); CreateStaticText(id,7,'Largura:',8); SetBelowItem(id, 5, 7, 0, 0); CreateEditInteger(id,8,0,6); SetRightItem(id,7,8,0,0); CreateRadioButtonGroupBox(id,9,'Oval',TRUE); SetRightItem(id,4,9,0,0); CreateStaticText(id,10,'Altura:',8); SetFirstGroupItem(id, 9, 10); CreateEditInteger(id,11,0,6); SetRightItem(id,10,11,0,0); CreateStaticText(id,12,'Largura:',8); SetBelowItem(id, 10, 12, 0, 0); CreateEditInteger(id,13,0,6); SetRightItem(id,12,13,0,0); result:=RunLayoutDialog(id,Dialog_Handler); IF result = 1 THEN BEGIN GetPt(pX, pY); Rect(pX-LAR/2, pY-ALT/2, pX+LAR/2, pY+ALT/2); Oval(pX-LAR/2, pY-ALT/2, pX+LAR/2, pY+ALT/2); END; END; RUN (EsteScript);
  12. JBenghiat, that worked perfectly, thanks a lot!
  13. twk, creating the rectangle before the GetPt, If I cancel it still wants a click and If I click Ok the rectangle in not draw where I click.
  14. I modified the dialog handler, but the script still requires me to click somewhere after I click the Cancel button. Why? PROCEDURE Retangulo; VAR Largura, Altura, LAR, ALT :INTEGER; pX, pY :REAL; id, result :LONGINT; PROCEDURE mDialogo(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN END; 1: BEGIN IF GetEditInteger(id,5,Largura) AND GetEditInteger(id,7,Altura) THEN LAR:=Largura; ALT:=Altura; END; 2: BEGIN END; END; END; BEGIN id:=CreateLayout('Retângulo',FALSE,'OK','Cancel'); CreateStaticText(id,4,'Largura:',8); SetFirstLayoutItem(id,4); CreateEditInteger(id,5,0,6); SetRightItem(id,4,5,0,0); CreateStaticText(id,6,'Altura:',8); SetBelowItem(id,4,6,0,0); CreateEditInteger(id,7,0,6); SetRightItem(id,6,7,0,0); result:=RunLayoutDialog(id,mDialogo); GetPt(pX, pY); Rect(pX-LAR/2, pY-ALT/2, pX+LAR/2, pY+ALT/2); END; RUN (Retangulo);
  15. Thanks for your reply! I saw the http://developer.vectorworks.net/index.php/VS:Creating_a_Custom_Dialog_Box and understood nothing. Searched for more information about it and found almost nothing. The GetPt has no index to interact with. Tried the If Did Not Cancel then GetPt did not work also. If I click the Cancel button the script still wants me to click somewhere to draw a rectangle. Yes it is just a test to create something where I click, I am just studying, and I know a lot of tools can be double clicked.
×
×
  • Create New...