Thread: Editbox help

  1. #1
    Registered User
    Join Date
    Jan 2006

    Editbox help

    Hi, im new to the fun world of C++, learning it gradually as i go...

    i have figured how to use the data the user enters in to an editbox like so

    wac<<"if never() then"<<endl;
    wac<<"breathtime ="<<Edit3->Text.c_str()<<endl;
    but what i would like to do, is divide the users input by half.

    so if they enter 20, it will create

    if never() then
    breathtime = 10

    in the wac file.

    any help with this would be appreciated


    ive added this to the "on key press" of the editbox

    void __fastcall TForm1::Edit2KeyPress(TObject *Sender, char &Key)
    if ((Key < 48 || Key > 57) && Key != 8) Key = 0;
    so now only numerical datacan be entered.... just leaves the division
    Last edited by brad.g; 01-10-2006 at 02:21 PM.

  2. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Manassas, VA USA
    //Convert from CString to int, then divide by 2
    wac<<"breathtime ="<< atoi(Edit3->Text.c_str()) / 2 <<endl;
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User
    Join Date
    Jan 2006
    Thanks alot for your help . il read through the FAQ's before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 08-25-2005, 03:09 PM
  2. Create two buttons that interact with an editbox
    By Arkanos in forum Windows Programming
    Replies: 8
    Last Post: 07-13-2005, 12:56 AM
  3. Create two buttons that interact with an editbox
    By Arkanos in forum C++ Programming
    Replies: 4
    Last Post: 07-11-2005, 01:17 AM
  4. editbox problem
    By tyouk in forum Windows Programming
    Replies: 7
    Last Post: 10-05-2004, 09:14 PM
  5. Editbox problems
    By Devil Panther in forum Windows Programming
    Replies: 9
    Last Post: 07-27-2003, 04:12 PM