php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61847 function newt_checkbox_tree_set_current runing unsuccessful
Submitted: 2012-04-25 08:45 UTC Modified: 2015-09-12 06:01 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nmred_2008 at 126 dot com Assigned: michael (profile)
Status: Closed Package: newt (PECL)
PHP Version: 5.3.10 OS: Centos 5.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nmred_2008 at 126 dot com
New email:
PHP Version: OS:

 

 [2012-04-25 08:45 UTC] nmred_2008 at 126 dot com
Description:
------------
Expectations after the runing this code ,the result is  test3... default Settings for the current item(The default is test1...), but the result  remains  is test1......

Test script:
---------------
 dl('newt.so');

  newt_init();
  newt_cls();

  newt_centered_window(60, 17, "Authentication Configuration");

  $form = newt_form();

  $checktree = newt_checkbox_tree_multi(2,2,10,' ab',NEWT_FLAG_SCROLL);

  newt_checkbox_tree_add_item($checktree, 'test1......', 1, 0,NEWT_ARG_APPEND, NEWT_ARG_LAST);
  newt_checkbox_tree_add_item($checktree, 'test2......', 2, 0,NEWT_ARG_APPEND, NEWT_ARG_LAST);
  newt_checkbox_tree_add_item($checktree, 'test3......', 3, NEWT_FLAG_SELECTED,NEWT_ARG_APPEND, NEWT_ARG_LAST);

  newt_checkbox_tree_set_current($checktree,2);


  newt_form_add_component($form, $checktree);
  newt_run_form($form);



Expected result:
----------------
Expectations after the runing this code ,the result is  test3... default Settings for the current item(The default is test1...)

Actual result:
--------------
after the runing this code the result  remains  is test1......


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-12 06:00 UTC] michael@php.net
Automatic comment from SVN on behalf of michael
Revision: http://svn.php.net/viewvc/?view=revision&revision=337815
Log: Fixed #61847
 [2015-09-12 06:01 UTC] michael@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: michael
 [2015-09-12 06:01 UTC] michael@php.net
Fixed in new release (1.2.9).

Please note, that newt_checkbox_tree_set_current only selects current item. To set current item value, use: newt_checkbox_tree_set_entry_value

See this example:

<?php

newt_init();
newt_cls();

newt_centered_window(60, 17, "Authentication Configuration");

$form = newt_form();

$checktree = newt_checkbox_tree_multi(2,2,10,' ab',NEWT_FLAG_SCROLL);

newt_checkbox_tree_add_item($checktree, 'test1', 1, 0, NEWT_ARG_APPEND, NEWT_ARG_LAST);
newt_checkbox_tree_add_item($checktree, 'test2', 2, 0, NEWT_ARG_APPEND, NEWT_ARG_LAST);
newt_checkbox_tree_add_item($checktree, 'test3', 3, NEWT_FLAG_SELECTED, NEWT_ARG_APPEND, NEWT_ARG_LAST);

newt_checkbox_tree_set_current($checktree, 2);
newt_checkbox_tree_set_entry_value($checktree, 2, 'b');

newt_form_add_component($form, $checktree);
newt_run_form($form);

newt_finished ();

var_dump(newt_checkbox_tree_get_selection($checktree));

newt_pop_window();
newt_form_destroy($form);
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 22:01:23 2020 UTC