[openbeos] Re: BTextControl Question

  • From: Zenja Solaja <solaja@xxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 30 Jan 2002 14:55:31 +1100

MakeEditable is not what you need.  You want
ftextcontrol->SetEnabled(false).  In your example, simply try:

bankdisplay[i].SetEnabled(false);

Simple.  Questions like these really need to go on the new BeDevTalk list
(Bruno or Daniel - please provide link).
Take care everyone.

> -----Original Message-----
> From: Travis Beaty [SMTP:travis_beaty@xxxxxxxxxxxxx]
> Sent: Wednesday, January 30, 2002 2:46 PM
> To:   openbeos@xxxxxxxxxxxxx
> Subject:      [openbeos] BTextControl Question
> 
> Hello All!
> 
> I'm a newbie BeOS programmer (well, actually, OBOS programmer now!), and
> I'm also fairly new to 
> programming in C++.
> 
> As a "starter" project for learning BeOS programming, I've decided to
> create a Polish notation calculator.  Part 
> of this calculator consists of four "banks," which hold values to be
> manipulated by the calculator.  The bottom 
> bank, "W," should be editable, so that the user can enter values (like a
> normal calculator).  The remainder of 
> the banks may not be edited by the user.
> 
> I've decided to implement the bank displays with BTextControls.  In
> Windows (sorry I'm being obscene on the 
> list, hehehe), I'd like to give the text controls the ES_READONLY flag.
> This is how I've tried to do it in my code, 
> using BTextView :: MakeEditable():
> 
> // START OF CODE
> 
> BTextControl 
>     *bank_display[4];        
> // (A field within the parent window's class).
> 
> // Excerpts from the parent window's class constructor ...
> 
> // labels for the bank displays.
> const char
>    bank_lbl[4][3] = {"Z:", "Y:", "X:", "W:"};  
> 
> // Location of next bank display control and reset button.
> BRect
>     bank_rect(5, 28, 155, 20),  
>     button_rect(160, 25, 220, 20);
> 
> // ...
> 
> for(int i = 0; i < 4; i++) {
> 
>     // Build a bank display TextControl and initialize it.
>     bank_display[i] = new BTextControl(
>         bank_rect, NULL, bank_lbl[i], "Hello!", new BMessage(-1),
>         B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
>     
>     bank_display[i]->SetDivider(20);
>     bank_display[i]->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
>     if(i != 3) bank_display[i]->TextView()->MakeEditable(false);
> 
>     // Increment the top and bottom members of bank_rect to set the 
>     // values up for the next control.
>     bank_rect.top += 25;
>     bank_rect.bottom += 25;
> 
> }
> 
> (Sorry if the formatting is messed up ... I have a bad problem with my
> code getting scrambled somewhere 
> between my computer and your computer.)
> 
> Unfortunately, when running the application, all text controls are still
> editable, and the call to MakeEditable() 
> does not appear to have any affect.  However, the calls to SetDivider()
> and SetAlignment() appear to work as 
> advertised.  This is either due to my lack of knowledge concerning the
> BeOS API, my lack of knowledge 
> concerning C++, or a hideous combination of the two.
> 
> Any help would be greatly appreciated.
> 
> Travis Beaty
> Evans, Colorado.
> 
> 
----------------------
CONFIDENTIALITY NOTICE
----------------------
This email is intended only to be read or used by the addressee.
The information contained in this e-mail message may be confidential
information. If you are not the intended recipient, any use, interference
with, distribution, disclosure or copying of this material is unauthorised
and prohibited. Confidentiality attached to this communication is not waived
or lost by reason of the mistaken delivery to you.

If you have received this message in error, please delete it and notify us
by return e-mail or telephone Aristocrat Technologies Australia Pty Limited
on +61 2 9413 6300.

Other related posts: