FLTK logo

Re: [fltk.general] Why do I need to convert a string to a string for Fl_Input

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Why do I need to convert a string to a string for Fl_Input imm Oct 06, 2022  
 
On Thu, 6 Oct 2022, 22:29 roger wrote:
Thx for the replies everybody. No sure I really "get it" but at least I know how to make it work. (s2 existed so I could look at the values in GDB)

Having said that, how should I code this so iy happens in one step?

string s1 = to_string(z);
win2_unitprice->value(s1.c_str());

There are possibly as many answers to that as there are programmers... Opinions will vary!

FWIW I'd be using C-strings & snprintf() probably. That's not the answer you need or want.

The easiest way might be to use an Fl_Value_Input widget instead, since that will accept your double z directly without conversions at all.
--
Ian
From my Fairphone FP3
   

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/CAGFM6daFykW9QiOrn53QxoMS44JcjCdgXjUOBXVO_J%3DbgeU8Hw%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.