IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
C++
Search C++ Group:

Advanced
-Collapse +Expand C++ To/From
To/FromCODEGuides
-Collapse +Expand C++ Study Test
PRESTWOODCERTIFIED
-Collapse +Expand C++ Store
PRESTWOODSTORE

Prestwood eMagazine

September Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyC++ BoardC++Builder Topic   Print This    All Groups  

Borland C++ Builder questions

Borland C++ Builder questions in C++Builder topic (part of our C++ group).

Quick Search: Borland   Builder   questions   Borland C   Borland C Builder  
helloworld02
-- USA
I have several questions, if you could answer even one of them (and preferably more if possible) that would be much appreciated. My questions are for an MDI application (Windows type, using mostly MDI parent and children) made in Borland C++ Builder (version 6, Pro.), using a combination of C and C++ code (about 15,000+ lines)

1. How can I change the Main (parent) formÆs menu bar (which has File, Edit, Window, etc)? Please answer for changing both File and the stuff under it (e.g. Close, Save, etc).

2. How can I create the HELP menu for my program? Ideally, IÆd like to have a Help menu item similar to that which BCB itself has, but would like to at least has some sort of text searching capability for the user

3. How can I check if the user entered a file of type .txt or .log, or of another type?

4. How can I add the standard MS Windows upper RH-corner stuff (the minimize, maximize, and close buttons like in Word) to a form that doesnÆt seem to automatically have them? (all the MDI child forms do, but the form in question is a fsNormal and shows buttons these in the design mode - but when I run my program, this form doesnÆt show them). Note that the form is an fsNormal, NOT an MDIChild, and is only made visible when a special menu button in the main form (on the level with the save, etc. buttons) is pressed.

5. Validating input into editBox:
a. How can I check if an editBox is empty? (editBox inputs have a representation as AnsiString, and I do StrToInt to get the integer from the string û how can I check if the AnsiString is a blank string prior to StrToInt). IÆve tried some ôtry-catchö variations, but I would like to keep allowing users to enter inputs in the form in any order they want. Have also tried variations on ôedtVal->Text.IsEmpty()==trueö, to no avail (this is never found to be true, even when I make it so).
b. In most of the editboxes, I do not allow negative integers. However, in some editboxes, I would like to allow this. Currently, to avoid non-integer symbols (e.g. punctuation, letters, etc) I am currently using MaskEdit with a mask of 99999999999;1;_
How should I change my mask to allow negative integers?

6. Is there any open-source code for a Up-Down button (the button under Win32 with an arrow for up and an arrow for down that is usually associated with an editBox so that the user doesnÆt have to type numbers) that allows numbers greater than 100 (much greater, as in up to a billion), and one that allows this range and a complementary range of negatives?

7. I am displaying a floating point number as an output in an editBox, through assignment. (i.e., double ans; edtOutput->Text = IntToStr(ans)Big Grin! . How can I reduce the number of decimal digits to a specific level of precision (i.e., only show 2 digits to the right of the decimal)?
 Posted 18 years ago (Thread Starter)
Comment Quote
About helloworld02 -Collapse +Expand
Visit Profile
Membership pending.
Member subscribes to this thread but email is NOT VERIFIED.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #8220, 2 replies
Thread Started 11/7/2002 10:19:00 AM
View Counter=11354
Last Reply Posted 11/8/2002 9:48:00 AM)
Location=-- USA 
Joined=18 years ago   MB Posts=1  
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
So, let's get the ball rolling... Big Grin!

I'll start with the easy one first.

4. Even though the form style is fsNormal, there are two other attributes you need to check:

  BorderIcons - if SystemMenu is not True, then the Close button does not show. Minimize and Maximize are self-explanatory.

  BorderStyle - If it is not bsSizeable or bsSingle, the Minimize and Maximize icons will not appear even if the icon settings are True in BorderIcons.

5. if Edit1->Text == ''

Now, for a question or two...

2. Are you asking about a menu on your TMainMenu, or linking an actual WinHelp file into your application?

I'll assume the latter. Once you have the WinHelp file built, put these two lines of code in your OnClick event for the Help menu:

Application->HelpFile = 'MYAPP.HLP'; or whatever name you give the file...
Application->HelpJump('Contents');

3. Are you asking how to get the file extension from a file name? Execute the ExtractFileExt function on the file name string.

More to come later...
 Posted 18 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #8221 (Level 1.1)  Reply to 8220
Thread Started 11/7/2002 12:41:00 PM
View Counter=2
Location=Las Vegas, NV USA 
Joined=18 years ago   MB Posts=442   KB Posts=19  
Most Recent Post
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
Okay...now for question # 1: Big Grin!

The answer is to use merged menus. The BCPB Developer's Guide does provide a section on doing this, but I'll give you a simple example here, using an MDI main form and an MDI child form.



The trick lies in using the GroupIndex property correctly. This matches up menus with identical captions between the MDI Child and main form, as long as the GroupIndex value is the same.



Also, the menu on the MDI Child must have AutoMerge set to true. Don't set this on the menu on the main form - the menu will disappear at run time if you do.



Okay, here is a menu on the main form, showing corresponding GroupIndex settings:

 File : 1
  New : 1
  Open : 1
  Print : 1
  Exit : 1
 View : 2
  Toolbars : 2
  Refresh : 2
 Tools : 4
  Options : 4
 Help : 5
  Topic Search : 5
  About : 6



and, here's the menu on the Child form:

 File : 1
  New : 1
  Open : 1
  Close : 1
  Save : 1
  Save As... : 1
  Print : 1
  Exit : 1
 Edit : 3
  Copy : 3
  Cut : 3
  Paste : 3
 Tools : 4
  Spelling : 4
  Import... : 4
 Help : 5
  Topic Search : 5



When no MDI child form is open, the main menu will only show the options I listed above for the main form. When an MDI child form is opened, the menu will show the same options as the child menu. The View menu will not be shown because it doesn't have a matching GroupIndex in the child menu. Likewise, the Help menu will only show Topic Search, because the child menu does not have an About option.

6.What version of BCPB are you using? My TUpDown in BCPB 5 allows negative numbers, and the full range is within the range of a small integer (-32768 to 32767).

Why do you need to go to a billion? Are you giving your users a large step increment in choices, say every 1000 or so? If your maximum range values divided by your step increment are less than 32767, then just use the TUpDown.Position value as a multiplier for your displayed (or edited) value.



Or, you could just use the TSpinButton from the Samples palette, and control the increment throught he OnDownClick and OnUpClick events.

7. You could use a TMaskEdit control instead, with a mask of 9990.09 (of course, it forces the user to type every character).



There are third party components (such as TurboPower's Orpheus components) with much more intelligent masked edit controls.



Another option is just to format the text, using a sprintf call, or the comparable Format function:

Edit1->Text = Format("%9.2f",[ans]);

IHTH
 Posted 18 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #8235 (Level 1.2)  Reply to 8220
Reply Posted 11/8/2002 9:48:00 AM
Location=Las Vegas, NV USA 
Joined=18 years ago   MB Posts=442   KB Posts=19  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1271A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #8220 Counter
11354
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2020 Prestwood IT Solutions.   [Security & Privacy]