Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

How to show left text for boolean field control?

Integrated Application Platform › Forums › General › How to show left text for boolean field control?

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 4 months ago by jaska_lee.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • September 10, 2014 at 1:38 am #791
    jaska_lee
    Participant

    I would like to show the text on the left of the checkbox for boolean fields on access. But the left text option for boolean field control doesn’t seem to be working. It works if you directly add a checkbox,

    Window(#(CheckBox 'Allow Bonus' lefttext:))

    But it does not show lefttex for boolean controls defined for table fields.

    Thanks

    September 10, 2014 at 5:33 pm #1107
    amckinlay
    Keymaster

    It is a result of Control.Construct and how it uses CheckBoxPairControl.

    It probably would not be too hard to fix CheckBoxPairControl to handle it.

    (it doesn’t help you, but this has changed in my latest code and now works correctly)

    September 11, 2014 at 2:35 am #1108
    jaska_lee
    Participant

    thanks andrew, I have modified two standard objects and it now seems to be working as I expected.

    1) CheckBoxPairControl
    Following changes make the text show on the left for CheckBox control.

    	PassthruController{
    Name: 'CheckBoxPair'
    New(prompt, checkbox, hidden = false) // old: (checkbox, prompt, hidden = false)
    {
    super(.layout(prompt, checkbox, hidden)) // old: (checkbox, prompt, hidden)
    c = .Horz.GetChildren()

    // old
    //.box = c[0]
    //.text = c[2]
    //.Ymin = .box.Ymin
    //.Top = .box.Top
    // old

    // new
    .text = c[0]
    .box = c[2]
    .Ymin = .text.Ymin
    .Top = .text.Top
    // new
    }
    layout(prompt, checkbox, hidden) //old: (prompt, checkbox, hidden)
    {
    text = Object('Static', prompt, notify:, hidden: hidden)
    for m in #(font, size, weight)
    if checkbox.Member?(m)
    text[m] = checkbox[m]

    //old: return Object('Horz', checkbox, #('Skip', 3), text)
    return Object('Horz', text, #('Skip', 3), checkbox)
    }
    Get()
    {
    .box.Get()
    }
    Set(val)
    {
    .box.Set(val)
    }
    SetFocus()
    {
    .box.SetFocus()
    }
    BnSetFocus()
    {
    .text.DrawFocusRect(true)
    }
    BnKillFocus()
    {
    .text.DrawFocusRect(false)
    }
    Static_Click()
    {
    if .box.GetEnabled()
    {
    .box.SetFocus()
    .box.Set(not .box.Get())
    .box.BN_CLICKED()
    }
    }
    }

    2) Construct method in Control object
    On Access control, I could not make the text align with the rest of the textboxes. But if I comment out the code concerning ‘prompt isn’t greyed’ for CheckBox, it aligns with others nicely and prompt isn’t greyed in protect mode. Is it safe to do it like this?

    	Construct(@x)
    {
    if (x.Size() is 1 and x.Member?(0) and Object?(x[0]))
    x = x[0]
    if (x[0] is 'NoPrompt' and String?(x[1]) and x[1] =~ "^[_a-z]")
    {
    c = x
    x = Datadict(x[1]).Control.Copy().Add(x[1] at: 'name')
    for m in c.Members()
    if String?(m)
    x[m] = c[m]
    }
    else if (String?(x[0]) and x[0] =~ "^[_a-z]")
    {
    name = x[0]
    dict = Datadict(name)
    x = dict.Control.Copy()
    hidden = false
    if .Custom isnt false and .Custom.Member?(name)
    {
    x.Merge(.Custom[name])
    hidden = .Custom[name].GetDefault('hidden', false)
    }
    x.name = name
    if "" isnt prompt = Prompt(name)
    {
    //if x[0] is 'CheckBox'
    //x = Object('CheckBoxPair', x, prompt, hidden: hidden)
    // need this so prompt isn't greyed when protected
    //else
    x = Object('Pair', Object('Static', prompt, hidden: hidden), x)
    }
    }
    _parent = this
    _ctrlspec = x
    ctrl = Construct(x, "Control")
    if (ctrl.Name > "")
    this[ctrl.Name] = ctrl
    return ctrl
    }
    September 11, 2014 at 7:57 pm #1109
    amckinlay
    Keymaster

    The other reason for CheckBoxPair is to get a focus rectangle on the prompt.

    When CheckBoxPair draws the text it handles the focus rectangle, but then it grays out the text when protected.

    If you use Pair (like in your changes) then Static draws the text so it is not grayed out, but you do not get a focus rectangle.

    Note: With your changes to Control.Construct, CheckBoxPair is not used any more.

    If you made your changes to CheckBoxPair but did not change Control then it should work as before.

    September 12, 2014 at 3:04 am #1110
    jaska_lee
    Participant

    if I don’t make the change to construct method, it goes like this(please see the screenshot) and i couldn’t get it align with the rest textboxes.
    i see the point of using ‘CheckBoxPair’, however, i actually prefer no rectangle on prompt when clicked.
    thanks for the tips andrew.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language