This Question is Assumed Answered

1 "correct" answer available (5 pts) 14 "helpful" answers available (3 pts)
7 Replies Last post: Apr 1, 2008 12:10 PM by mgordon

How to call the one layout to another layout

Mar 31, 2008 1:37 AM

Click to view mannusanghi's profile Level 2 mannusanghi 30 posts since
Feb 27, 2008

Hi All...

I have some problem for calling one layout to another layout. For hearing its quite simple. But i got stuck .

I have a main LayoutPage in which there is a submit button by this button i can easily call the another layout .

But next time when new layout will open, there is also a sumbit buttton and there i want to open another layout that time i m not able to call new layout. So i want to replace one layout to another and want to go back also.

so pleae help me is there any solution.

Thanks in advance!!!

Akash Jain

Click to view URPradhan's profile BlackBelt URPradhan 167 posts since
Mar 6, 2008
1. Re: How to call the one layout to another layout Mar 31, 2008 2:35 AM

I know how to call another "dialog layout".

Suppose I have the main "Canvas Layout::L1" and another "Dialog Layout::L2".

In L1.button's on action; call ... L2.container.show for a L2 object. But if L2 is a "Canvas Layout" I donot know :(


Another thing I also want to add ...

Is there any visible?=true/false ioption for UI grapics controls including the layouts ?

Like I can say CommandButton.visible?=false, <any layout>.visible?=false ......

//Thanx

Click to view Kamal's profile Curl Kamal 149 posts since
Oct 17, 2007
2. Re: How to call the one layout to another layout Mar 31, 2008 5:52 AM
Could you please explain what you mean by "Layout" here. In Curl technology "Layout" is an object that glues one Graphical object to another.

Could you please put a small example here so that we all can be on the same page.


Dialog is a special kind of Frame. It has a "show" method. When you call this method, this Frame is put inside a View and then shown. Of course, if the Dialog was a part of Graphical hierarchy then it will be detached from that hierarchy and as I said earlier, it will be shown in its own View.


"visible?" is a local option on a Graphic. So for any Graphic you can call visible? = false to hide it. There is one exception here. It will not have an effect on a View. You will need to set the "visibility" of a View to hide it.

Message was edited by: Kamal

Click to view URPradhan's profile BlackBelt URPradhan 167 posts since
Mar 6, 2008
3. Re: How to call the one layout to another layout Mar 31, 2008 10:22 PM
in response to: Kamal
As I understood, Layout is a top level graphical container which can contain multiple child graphical objects.

And if he has 2 layouts having different controls over them. he wants to show a layout by clicking a command button from another layout.


Think like VB forms. Showing one form from another, may be ....


sub Form1.cmdShow.click()

Form2.show vbModal
me.hide
end sub

//Thanx
Click to view Duke's profile Curl Duke 179 posts since
Oct 17, 2007
4. Re: How to call the one layout to another layout Mar 31, 2008 10:44 PM
You can make use of the Frame.add method, using the keyword parameter replace? = true
Click to view mannusanghi's profile Level 2 mannusanghi 30 posts since
Feb 27, 2008
5. Re: How to call the one layout to another layout Mar 31, 2008 10:55 PM
in response to: Duke

Hi Duke , Kamal

Thanks for your suggestions.

But I dont want to replace with a frame or add .I wants to replace first layout with next one. On the click of submit button.

Regards,

Akash Jain

Click to view Kamal's profile Curl Kamal 149 posts since
Oct 17, 2007
6. Re: How to call the one layout to another layout Apr 1, 2008 6:08 AM
in response to: mannusanghi

Unfortunately I still do not understand the problem so this may not be the answer you are looking for.

Curl has two types of Containers. One which can have a Single Child, like a BaseFrame (Frame for example is a subclass of it). The other one is a SequenceBox (VBox, HBox, Canvas etc are subclasses of it) that can have multiple children.

View (Top level Window) / AppletView (Child Window, e.g. when in Browser) are the two objects that represent a Window and a Child Window respectively. All of your Graphical contents will be in one of these.

Do you want to put say two children inside a VBox and want to show/hide one or the other - like a dropdown pane?

Or you have two children say of VBox. You want to show another View or a Popup Dialog (which basically is a View) when you click on one Child and another one when you click on the other Child.

Or you have a SequenceBox with two Dialogs (remember they are Frames). When you say show one of them then the Dialog is shown in its own View. In this case the Dialog is removed from the SequenceBox Graphical Hierarchy. Now when you close this Dialog's View, you want the Dialog to be back where it was removed from (the original SequenceBox container)?

If it is none of the above cases then kindly add some code, that I can look at, to understand and answer your question to your satisfaction.

Click to view mgordon's profile Curl mgordon 48 posts since
Oct 17, 2007
7. Re: How to call the one layout to another layout Apr 1, 2008 12:10 PM
Writing Curl is more like using Ajax than a traditional HTML page, because you want to read data from the server and update some part of the display instead of replacing the applet or web page completely.

When you call HttpForm.submit, the Curl RTE submits the form data and opens a new browser with the response from the server. This is done automatically when you use a {submit-button} in your form and the user clicks on it. This may not be what you want. The alternative is to call HttpForm.submit-open instead, as in this example:
{HttpForm
    {url "http://www.curl.com/cgi-bin/list-parameters.pl"},
    target="_blank",
    {spaced-hbox
        {text Your name:},
        {TextField name="name"},
        {reset-button},
        {submit-button}
        ,
        {CommandButton
            label = "Submit and Read",
            {on Action at b:CommandButton do
                let d:#Dialog = b.dialog
                {type-switch d
                 case form:HttpForm do
                    let tis:HttpTextInputStream = 
                        {form.submit-open}
                    let response:StringBuf = {tis.read-one-string}
                    {tis.close}
                    {dump response}
                 else
                    {error "Button not in HttpForm"}
                }
            }
        }


    }
}

Here the button labelled Submit will open a new browser with the server response and the button Submit and Read will dump the server response to the output console. In a real application you'd have the server return JSON or XML (or any other type of response you can handle on the client side) and use JsonValue-parse or the SAX parser (or something else) to parse the response and update your UI. That's when you might find yourself calling Frame.add replace? = true on some Frame in your UI.