Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Center dynamic form in horizontal layout

    Hi,

    I'm trying to center a dynamic form in a horizontal layout. I'm not having much luck. Here is the latest version of my code. What am I doing wrong?

    Code:
    <SCRIPT>
      (function () {  
        isc.HLayout.create({
        ID: "hLayoutAlignCenter",
        autoDraw: true,
        // Specifying the width creates space within which to
        // center the members.
        width: "100%",
        height: "100%",
        layoutMargin: 6,
        membersMargin: 6,
        border: "1px dashed blue",
        //align: "center", // As promised!
        members: [
          isc.DynamicForm.create({
            ID: "loginForm",
            colWidths: [100, 200],
            align: "center",
            //dataSource: "users",
            useAllDataSourceFields: true,
            fields: [
              {type:"header", defaultValue:"Please login"},
              {name: "User Name", required: true},
              {name: "password", type: "password", required: true},
              {name: "validateBtn", title: "Validate", type: "button", click: "form.validate()"}
            ],
            values : {
              user_name: "Bob",
              password: "",
          }
    })
    ]
    });
    })();
    </SCRIPT>
    Thanks,
    -G

    #2
    "align" in not a property on DynamicForm. See the docs for Canvas.layoutAlign if you want centering on the "breadth" axis of a Layout. To center along the "length" axis, use two spacers set to "*" size.

    Comment


      #3
      Hi,

      Thanks for the reply. Unfortunately, the Canvas.layoutAlign doc took me right back to the example I started with. No worries though.

      Thanks,
      -G

      Comment


        #4
        Sorry, not sure what this means: if you follow the link to the sample from the docs, you will find correct code that works. We do not have any samples that attempt to use the nonexistent property you were trying.

        Are you still struggling in some way?

        Comment


          #5
          Hi,

          Yeah. I'm not really getting anywhere with this. I just tried the align property on the form, because I was stuck. I've been trying to use SmartClient for a few years now and it seems like I always hit a wall pretty quickly. Unfortunately, project timelines always make me punt and take another path. I can see that I would end up being one of those people that would be posting to the forum everyday to complete a project and that's just annoying for everyone.

          Thanks Again,
          -G

          Comment


            #6
            We would not recommend an approach of guessing a property name, and then posting here if it doesn’t work - that’s not necessary, and very ineffective.

            Instead, since both the documentation and samples are searchable, and since Google also indexes both our documentation and these forums, a simple search will take you directly to what you need.

            Then, you can work very efficiently with SmartClient, as countless developers have experienced.

            Comment


              #7
              Hi,

              Ok. Point taken. I'm sure it's just me. Thanks for your time.

              Thanks,
              -G

              Comment


                #8
                Oh, we should mention, ChatGPT can also answer this question correctly, and many others about SmartClient.

                That’s because ChatGPT has essentially “read” our documentation, which is very cool, and gives you an idea of how effective you can be purely from the docs!

                Indeed, you can ask ChatGPT to create whole screens, or even subclasses of SmartClient components, for various purposes - it’s mostly right! And that’s purely from the docs and samples - pretty neat.

                Comment


                  #9
                  Hi,

                  I wasn't going to post another reply, but y'all took the time to answer my post, so I think it is the right thing to do.

                  I tried asking chatGPT about this problem and it was not able to provide a working example. I tried rephrasing the question in many different ways, but still no joy. I also looked at the doc you mentioned, but nothing obvious there. I really don't understand why something that should be so simple turns out to be so difficult. I have 3 other similar javascript libraries and I was able to accomplish the same thing with them in a few minutes. One of them I had just purchased for use in another project, so I hadn't used it before. I'm using Brave browser, so maybe that is the problem. I was trying to force myself to use Smartclient, because I had already paid for it a while back. I also tried to accomplish a few other things that I new I would need and got bogged down again pretty quickly. If you extend that to several days to solve each little issue, it just doesn't make sense for me financially. Nothing against Smartclient here. I have no doubt that it has many happy users. It's clearly not the right tool for me though. Thanks again for your time.

                  Thanks,
                  -G

                  Comment


                    #10
                    Sorry, but to be frank, this is completely bizarre - we are wondering if you might be either joking or trolling ... ?

                    It takes just one property to achieve what you want - layoutAlign:"center". It is documented and you have been pointed to the documentation. The documentation even points to a sample showing its usage.

                    Copying and pasting your first post into ChatGPT also leads to the correct answer. How could you possibly have made multiple attempts and not gotten the right result, when your own post immediately works?

                    This literally could not be made simpler, so again, sorry if we're wrong, but this appears to be trolling.

                    Comment

                    Working...
                    X