Jump to content

Help with Swap Panes


EduardoS

Recommended Posts

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);

Link to comment

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);

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