title: Call a default constructor from another one in Kotlin
body: <p>In Kotlin, when a class has multiple constructors how can we call the <em>designated</em> (coming from iOS world I could not find a better name) constructor from within another constructor.</p>
  
  <p>Let me show you an example</p>
  
  <pre><code>final class LoadingButton: LinearLayout {
      var text:String? = null
  
      constructor(context: Context, text: String) : this(context) {
          this.text = text
      }
      constructor(context: Context) : super(context) {
          val t = this.text
          this.view {
              button(t) { /* ... */}
          }
      }
  }
  </code></pre>
  
  <p>Here if I do <code>loadingButton("TEST", {})</code> that string is not propagated to the button because <code>this(context)</code> is called before the code inside the <em>convenience</em> constructor (sorry again :). </p>
  
  <p>Can that be solved in Kotlin ? Something like</p>
  
  <pre><code>constructor(context: Context, text: String) {
      this.text = text
      this(context) 
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Just to clarify the idea since it's been asked, the idea is to write something like this in an activity :</p>
  
  <pre><code>onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
  
      verticalLayout {
          loadingButton("Some text")
          //or
          loadingButton() { this.text = "Some text"}
  }
  </code></pre>
  
  <p>This is obviously not that much useful but you get the idea. The text property can be known at construction or later on. </p>
  
  <p>This is especially not useful since Kotlin has default values for parameters but I am studying the language and ran into this problem.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>Another clarification is that I'm using <a href="https://github.com/Kotlin/anko" rel="noreferrer">Anko</a> for the layout, so the <code>loadingButton</code> methods look like this:</p>
  
  <pre><code>inline fun ViewManager.loadingButton() = loadingButton {  }
  inline fun ViewManager.loadingButton(init: LoadingButton.() -&gt; Unit) = ankoView({ LoadingButton(it) }, init)
  inline fun ViewManager.loadingButton(text: String, init: LoadingButton.() -&gt; Unit) = ankoView({ LoadingButton(it, text) }, init)
  </code></pre>