What to use instead of "cin" and "cout" which VCL doesn't use

I want to ask the user their name which I will then put on a label.   There may be a better way but in the meantime I have used a TextOut message to Ask for their name and then put a memo box at the end of the sentence, which I find they can type into, I think.

Question is How can I get or where to I find what they typed so I can put it in my label storage.  I notice that there is a "Lines" property for Memo that say TString and if you click on it you get a code editor.   I have been reading for days but I can figure out where to go from here.

Any help would be greatly appreciated

Rowland
0
Rowland
10/2/2009 12:18:45 AM
embarcadero.cppbuilder.using 1848 articles. 1 followers. Follow

5 Replies
1053 Views

Similar Articles

[PageSpeed] 36
Get it on Google Play
Get it on Apple App Store

> {quote:title=Rowland Stevens wrote:}{quote}
> I want to ask the user their name which I will then put on a label.   There may be a better way but in the meantime I have used a TextOut message to Ask for their name and then put a memo box at the end of the sentence, which I find they can type into, I think.
> 
> Question is How can I get or where to I find what they typed so I can put it in my label storage.  I notice that there is a "Lines" property for Memo that say TString and if you click on it you get a code editor.   I have been reading for days but I can figure out where to go from here.
> 
> Any help would be greatly appreciated
> 
> Rowland


 Why do you need a TMemo? A TEdit should be enough for a single line of text. Then the following should work. My TEdit is called "Amount"

void __fastcall TForm1::AmountExit(TObject *Sender)
{       char *buff3 = new char[20];
        Amount->GetTextBuf(buff3,Amount->GetTextLen()+1);
        Label1->Caption=buff3;
      delete buff3;
}

George.
0
George
10/2/2009 5:26:18 PM
> {quote:title=George Probyn wrote:}{quote}
> > {quote:title=Rowland Stevens wrote:}{quote}
> > I want to ask the user their name which I will then put on a label.   There may be a better way but in the meantime I have used a TextOut message to Ask for their name and then put a memo box at the end of the sentence, which I find they can type into, I think.
> > 
> > Question is How can I get or where to I find what they typed so I can put it in my label storage.  I notice that there is a "Lines" property for Memo that say TString and if you click on it you get a code editor.   I have been reading for days but I can figure out where to go from here.
> > 
> > Any help would be greatly appreciated
> > 
> > Rowland
> 
> 
 Or if you must use a memo presumably you can reverse the following:
  
 Memo2->Lines->Strings[1]=resp;

 and write Label1->Caption=Memo2->Lines->Strings[1]; to pick up the first line of the memo text. You only use the code editor at design time to fill in the memo.

George.
0
George
10/2/2009 5:33:52 PM
Hi George;
Thank you so much for your reply.  Exactly what I needed to know.  And it works and does exactly what I wanted!  I used "Memo" only because while the words "TMemo" and TEdit" were both words I had previously come across , I had never worked with either.  And I find it difficult to remember the context in which I read them until I have "worked" with them a while.....then I can remember!  So I happen to rerun across Memo and thought maybe that will work.    Edit was never thought of!  That is I didn't choos
e "Memo" over "edit!  You're right.   I have absolutely no need for the extra space of memo!

That's again .  I really appreciate it.  You gave me the answer that several days of searching on my own had not given me.  I also appreciate the time you have spent, which is a limited resource for all humans.

Rowland
0
Rowland
10/2/2009 8:32:16 PM
<Rowland Stevens> wrote in message news:168416@forums.codegear.com...

> I want to ask the user their name which I will then put on a label. 
> There may
> be a better way but in the meantime I have used a TextOut message to Ask
> for their name and then put a memo box at the end of the sentence, which I
> find they can type into, I think.

Lok at the VCL's InputQuery() and InputBox() functions instead.

> How can I get or where to I find what they typed so I can put it in my 
> label storage.

TMemo has a Text property.

InputBox() and InputQuery() both return the typed text directly.

> I notice that there is a "Lines" property for Memo that say TString and if
> you click on it you get a code editor.

At design-time, yes.  Not at run-time.  Look at TStrings in the 
documentation.  It has its own Strings[] and Text properties for accessing 
the actual text content.

-- 
Remy Lebeau (TeamB)
0
Remy
10/3/2009 8:00:13 AM
<George Probyn> wrote in message news:168715@forums.codegear.com...

> void __fastcall TForm1::AmountExit(TObject *Sender)
> {       char *buff3 = new char[20];
>        Amount->GetTextBuf(buff3,Amount->GetTextLen()+1);
>        Label1->Caption=buff3;
>      delete buff3;
> }

Use the Text property instead (especially since the code above has 2 bugs in 
it), ie:

{code:cpp}
void __fastcall TForm1::AmountExit(TObject *Sender)
{
    Label1->Caption = Amount->Text;
}
{code}

-- 
Remy Lebeau
Lebeau Software - Owner, Software Enginneer
http://www.lebeausoftware.org
0
Remy
10/3/2009 8:01:44 AM
Reply:

Similar Artilces:

RFC: interactions between "use bytes", "use locale", and "use feature 'unicode_strings'
I am waiting for blead to reopen before I submit a patch for extending feature unicode_strings to matching \s, and \w. In documenting it, it occurred to me that the existing implementation is wrong, along with the existing interaction between use bytes and use locale. To refresh your memory, "use feature 'unicode_strings'" is supposed to mean that even non-utf8 data is to be considered to have Unicode semantics. In practice, this only affects the characters from 128-255. It is new in 5.12, and is implemented there only on functions that change case, such a...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

(setxkbmap) can't use "ALT_GR"/"left ALT" button after using it
hello folks i use LXDE as i'm known and my only solution to switch keyboard is to use setxkbmap now after i define keyboards layouts to switch and chose ALT+Shift to switch it goes "bugged" using the right ALT will switch the layouts and i'm not able to write the "other" letters help please P.S : this is the command i use �setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll fr,ar� -- SAFAD ------------------------------------------------------------------------ bump up rotfl! -- SAFAD -------------------------------...

[ID 20020307.006] [BUG][use encoding] use encoding 'greek'; print "not" unless pack("U*", 0x3af) eq pack("C*", 0xdf) prints "not"!
This is a bug report for perl from "Anton Tagunov" <tagunov@motor.ru>, generated with the help of perlbug 1.33 running under perl v5.7.3. ----------------------------------------------------------------- Hello, developers! Hello, Jarkko! Please consider the following test being added: --- lib/encoding.t.orig Fri Feb 8 07:12:05 2002 +++ lib/encoding.t Thu Mar 7 19:38:39 2002 @@ -1,4 +1,4 @@ -print "1..19\n"; +print "1..20\n"; BEGIN { if (ord("A") == 193) { @@ -89,3 +89,7 @@ print "not " unless "\x...

RFC: Make "use 5.14" select "use re '/a' " ?
I have pushed to blead (with Jesse's permission) the last commits (besides doc and any bug fixes) that enable the /a regular expression modifier. Presuming it works ok, should this become the default method of operation, signified by a "use 5.014" ? On 1/17/11 11:02 AM, Karl Williamson wrote: > Presuming it works ok, should this become the default method of > operation, signified by a "use 5.014" ? So when I upgrade my code, I have to put "no re '/a'" in every file? Why, oh why? On Mon, 17 Jan 2011, Elliot Shank wrote: > ...

use of "?" operator instead of "if"
Hi: I have this statement which checks for existence of the $VAL variable and performs certain actions if($VAL){ $VAL = "$VAL:$expr"; } else { $VAL = "$expr"; } Can this 4 line statement be reduced to a single line using "?" operator? Thanks Ravi __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://platinum.yahoo.com It's called the ternary operator, and works like this: $VAL ? $VAL = "$VAL:$expr" : $VAL = "$expr"; IF_EXPR ? T...

Replacing "use base" with "use parent"
--bcaec554da9c7514d304ca32ffa3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, From the base.pm documentation<http://perldoc.perl.org/base.html#DESCRIPTIO= N>: Unless you are using the fields pragma, consider this module discouraged in favor of the lighter-weight parent . From the parent.pm documentation<http://perldoc.perl.org/parent.html#HISTOR= Y> : This module was forked from base to remove the cruft that had accumulated in it. parent.pm is a 30 lines pure Perl dual module available also in core since 5.10...

RE: Using "do" versus "use" for subroutine
Edward Wijaya wrote: > Hi, > > I would like to know which of this > is better and what is the pro and cons: > > 1. A file "mysub.pl" which stored > a subroutine, and later called by > main file using: do "mysub.pl" > > or > > 2. A file "mysub.pm" and called > in main file using : use "mysub.pm" The second construct is not valid; the argument to "use" must be a bareword. It's not really possible to answer your question without knowing more details. I'm not clear about what&#...

Can't use string ("1") as a HASH ref while "strict refs" in use at ./policy.sanitizer line 255.
Hi there, I am trying to figure out why the following lines are giving me an error: --- snip --- $found{filter}{$filter}{family}{$family} = 1; print keys %{ $found{filter}{$filter}{family} }; --- snip ---- here's the error Can't use string ("1") as a HASH ref while "strict refs" in use at ../policy.sanitizer line 255. I am trying to the display all the keys for $found{filter}{$filter}{family} please Cheers, Noah On 10/9/09 Fri Oct 9, 2009 2:12 PM, "Noah" <noah-list@enabled.com> sc...

superreview requested: [Bug 315633] "Create Profile" dialog text doesn't match button text: "Click Finish"->"Done", "click Next"->"Continue" : [Attachment 206616] Use Mac-appropriate text in profile #2
Steuard Jensen <steuard+mozilla@slimy.com> has asked Daniel Veditz <dveditz@cruzio.com> for superreview: Bug 315633: "Create Profile" dialog text doesn't match button text: "Click Finish"->"Done", "click Next"->"Continue" https://bugzilla.mozilla.org/show_bug.cgi?id=315633 Attachment 206616: Use Mac-appropriate text in profile creation https://bugzilla.mozilla.org/attachment.cgi?id=206616&action=edit ...

superreview requested: [Bug 315633] "Create Profile" dialog text doesn't match button text: "Click Finish"->"Done", "click Next"->"Continue" : [Attachment 206616] Use Mac-appropriate text in profile #3
Daniel Veditz <dveditz@cruzio.com> has asked Benjamin Smedberg [:bs] (bsmedberg@) <benjamin@smedbergs.us> for superreview: Bug 315633: "Create Profile" dialog text doesn't match button text: "Click Finish"->"Done", "click Next"->"Continue" https://bugzilla.mozilla.org/show_bug.cgi?id=315633 Attachment 206616: Use Mac-appropriate text in profile creation https://bugzilla.mozilla.org/attachment.cgi?id=206616&action=edit ------- Additional Comments from Daniel Veditz <dveditz@cruzio.com> blame says bsmed...

AUTOLOG.EXE used for a VM doesn't work for "AutoLogon to Wkstn, don't use E-Dir"
Hi. Server: Open SUSE 10 (2.6.18.2.34), running VMWare 1.0.4 Client: WinXP-SP2 + all sec.upd., VMWare tools installed. NWClient: 4.91.4 + patches [1] When I use Autolog to set "AutoLogon to Wkstn, don't use E-Dir", then the result is *NOT* what I'm used to for other workstations: The Novell Login Screen *DOES* show up. After 2-3 Minutes it dissappeares without any user interaction and then the local WinLogon happens as expected. Any suggestions? Regards, Rudi. [1] _491psp2_3_4_nwspool_3.inf _491psp3_4_nicm.inf _491psp4_lgncxw32.inf _491psp4_log...

how to use "Match" the special char "\" as using filter
Thx JJ \\ "JJ" <jasonyklau@sinaman.com> wrote in message news:404bd593$1@forums-2-dub... > Thx > JJ > > ...

Web resources about - What to use instead of "cin" and "cout" which VCL doesn't use - embarcadero.cppbuilder.using

Resources last updated: 1/6/2016 10:00:24 PM