Ticket #13 (closed defect: fixed)

Opened 9 months ago

Last modified 9 months ago

ComboBox setActiveText

Reported by: keinfarbton Assigned to: Pse
Priority: major Milestone:
Component: gtkd - classes Version: 1.0
Keywords: Cc:

Description

gtkd/src/gtk/ComboBox.d line 195

This method did not work for me. So here my suggestion:

    public void setActiveText(char[] text, bool insert=false)
    {
        version(DidNotWorkForMe){
            int currActive = getActive();
            int active = 0;
            bool found = false;
            setActive(active);
            bool found = false;
            while ( !found && active==getActive)
            {
                found = text==getActiveText();
                ++active;
            }
            if ( !found )
            {
                if ( insert )
                {
                    appendText(text);
                    setActive(active);
                }
                else
                {
                    //setActive(currActive);
                    setActive(-1);
                }
            }
        }
        else{
            // This works for me ...
            int active = 0;
            setActive(0);
            while ( getActive >= 0 ) // returns -1 if end of list if reached
            {
                if( text==getActiveText()){
                    return;
                }
                ++active;
                setActive(active);
            }
            // was not found, the combo has now nothing selected
            if ( insert )
            {
                appendText(text);
                setActive(active);
            }
        }
    }

Change History

12/29/07 20:04:17 changed by keinfarbton

  • component changed from Addon - gda to gtkd - classes.

12/29/07 20:29:31 changed by Pse

  • owner changed from JJR to Pse.

12/29/07 20:29:45 changed by Pse

  • status changed from new to assigned.

12/29/07 21:00:57 changed by Pse

In r349. Please test. Would you like to be added to the AUTHORS file?

(follow-up: ↓ 6 ) 12/29/07 21:52:39 changed by keinfarbton

  • status changed from assigned to closed.
  • resolution set to fixed.

on linux -r349 demos/demoselect.sh has no executable permissions set. So building gtkd with dsss fails.
The change seems to work for me, but there is this typo in the comment :)
...is reached

AUTHORS file would be nice, thx.

(in reply to: ↑ 5 ) 12/29/07 22:54:50 changed by Pse

Replying to keinfarbton:

on linux -r349 demos/demoselect.sh has no executable permissions set. So building gtkd with dsss fails.
The change seems to work for me, but there is this typo in the comment :)
...is reached AUTHORS file would be nice, thx.

I'll add you as "keinfarbton". If you'd like a different name, please post it here.

I've noticed the problem with executable permissions, too. It seems to have happened somewhere along the latest branch merge. I'll look into fixing it.

Thanks.