NiGui icon indicating copy to clipboard operation
NiGui copied to clipboard

How to use controls such as select list,checkbox,radio?

Open shawnye opened this issue 6 years ago • 8 comments

Thank you for nice work! That's what I want.

How to use controls such as select list,checkbox,radio?

BTW, how to add address bar when open dialog?

Thank you!

shawnye avatar Nov 12 '17 07:11 shawnye

The project is in a very early stage. It first needs more developers and then decisions how to go forward. I think before implementing more controls, the general concept should be finished and documented. If there is any interested developer (especially on macOS), please contact me.

simonkrauter avatar Nov 12 '17 18:11 simonkrauter

Dankr4d is working on these: https://github.com/Dankr4d/nigui/tree/widgets

enthus1ast avatar Nov 15 '17 13:11 enthus1ast

@enthus1ast thank you! I will try it

shawnye avatar Nov 16 '17 04:11 shawnye

Is checkbox usable on Windows since nim v1.0? found NativeCheckbox* = ref object of Checkbox seems incomplete. What to do if I try to finish this?

gogolxdong avatar Sep 26 '19 04:09 gogolxdong

I have implemented checkboxes here recently, no known issues. Yes, NiGui works with Nim 1.0. Other widgets will follow at some time.

simonkrauter avatar Sep 26 '19 07:09 simonkrauter

Great, probably

var checkbox = newCheckbox("Checkbox")
checkbox.init()
checkbox.text = "Checkbox"
container.add(checkbox)

helps to see how checkbox works in exmpale_02_controls.nim

cn-care avatar Sep 26 '19 13:09 cn-care

@cn-care: example_02_controls.nim already contains a checkbox. In your code example, you should not call init(), because it's called automatically in newCheckbox().

simonkrauter avatar Sep 26 '19 14:09 simonkrauter

May be add this to the example_02_controls.nim

    # Add a further Checkbox control:
    var checkbox2 = newCheckbox("Checkbox2")
    container.add(checkbox2)

   # Add toggle event to the checkbox
    checkbox.onToggle = proc(event: ToggleEvent) =
      case  checkbox.checked
        of true:  textArea.addLine("Checkbox was checked")  
        of false: textArea.addLine("Checkbox was unchecked")

    # Add toggle event to the checkbox2 to enable/disable checkbox
    checkbox2.onToggle = proc(event: ToggleEvent) =
      case  checkbox.enabled
        of true:
                  checkbox.enabled = false 
                  textArea.addLine("Checkbox was disabled")  
        of false:
                  checkbox.enabled = true  
                  textArea.addLine("Checkbox was enabled")

qqtop avatar Oct 12 '19 02:10 qqtop