Results 1 to 4 of 4

Thread: Problem with CL_Spin with float values

  1. #1

    Default Problem with CL_Spin with float values

    Hi!

    Hope somebody can help me, I'm working on GUIComponent with a lot of CL_Spin elements. Now wanted to make a CL_Spin with float values, and it don't work as I would expect.

    Thats my Spin:

    Code:
    	spin_maxroaddistratiotertconn = new CL_Spin(this);
    	spin_maxroaddistratiotertconn->set_geometry(CL_Rect(client_area.left + 150, client_area.top + 455, CL_Size(100, 20)));
    	spin_maxroaddistratiotertconn->set_number_of_decimal_places(2);
    	spin_maxroaddistratiotertconn->set_value_float(2.0f);
    	spin_maxroaddistratiotertconn->set_step_size_float(0.1f);
    	spin_maxroaddistratiotertconn->set_ranges_float(1.0f, 5.0f);
    	spin_maxroaddistratiotertconn->set_floating_point_mode(true);
    	spin_maxroaddistratiotertconn->set_visible(false);
    The problem is, that when I look at the spin in my program, the spin displays me the value is 0 (but the value which I get with get_value_float is 2.0), but when I click to one of the arrows (up/down) the value changes to 1.9/2.1
    Ok it is late, but I am still a little bit confused about this behavior and I am not sure what I do wrong. Maybe someone can help me. :-)

    PS: Sorry for my bad english
    Last edited by Hikaruchan; 09-07-2011 at 01:25 AM. Reason: Further information

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    First change: "set_visible(false);" --> "set_visible(true);"

    Then move: "set_floating_point_mode(true);" after "new CL_Spin(this);"

    The "set_floating_point_mode()" fix should not be required in ClanLib 2.3 SVN (or ClanLib 2.4 SVN)

    SVN commit:
    CL_Spin fixes - initial step_size was not initialised. The set_xxx functions now imply the floating point mode. set_floating_point_mode(false) sets the lineedit correctly. clamp_value() returns value changed state

  3. #3

    Red face

    Thanx you so much!!!!

    That was the hint I needed because I am on 2.2.6:

    Then move: "set_floating_point_mode(true);" after "new CL_Spin(this);"

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    We really recommend all users to upgrade to ClanLib 2.3.

    The main development now happens on 2.4 (unstable branch), the bugfixes are backported to 2.3, and some of the most critical fixes end up in 2.2, but not all...

    All breaking changes between 2.2 and 2.3 (and how to fix them) are documented at http://clanlib.org/wiki/BreakingChanges.
    Last edited by sphair; 09-07-2011 at 08:31 AM.

Similar Threads

  1. CL_PerlinNoise to float array
    By butterquark in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 08-24-2011, 06:46 AM
  2. CL_PI define float vs double
    By rombust in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 01-04-2010, 09:09 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •