EduardoS Posted September 12, 2018 Share Posted September 12, 2018 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); Quote Link to comment
JBenghiat Posted September 13, 2018 Share Posted September 13, 2018 Without digging too much in the code, your case statement uses 4 instead of 5. You may may want to get in the habit of using constant for dialog item ids. It helps eliminate some errors where you get your ids confused. Quote Link to comment
EduardoS Posted September 13, 2018 Author Share Posted September 13, 2018 JBenghiat, after posting this I figured out the 4 instead of 5... Fixed it, but it still does not swap panes. Quote Link to comment
EduardoS Posted September 13, 2018 Author Share Posted September 13, 2018 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); Quote Link to comment
Recommended Posts
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.