Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Resize textbox based on amount of text

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-02-2008, 09:18 PM
Senior Member
 
Join Date: Sep 2008
Posts: 161
Default Resize textbox based on amount of text

Would there be a way to calculate the textbox size based on how much lines of text there is in it? I don't want to have a scollable control in another scrollable control and that seems to be the best solution.
__________________
Reply With Quote
  #2 (permalink)  
Old 12-03-2008, 03:00 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

A multiline textbox without scrollbars will help you?
Reply With Quote
  #3 (permalink)  
Old 12-03-2008, 09:12 PM
Senior Member
 
Join Date: Sep 2008
Posts: 161
Default

Quote:
Originally Posted by Erel View Post
A multiline textbox without scrollbars will help you?
I know but I already scroll the whole form (using a panel in a panel) so it makes a frame in a frame. Not cool.
__________________
Reply With Quote
  #4 (permalink)  
Old 12-04-2008, 05:48 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You can use ImageLib.StringWidth and ImageLib.StringHeight to estimate the size required to display a string.
Reply With Quote
  #5 (permalink)  
Old 12-04-2008, 09:15 PM
Senior Member
 
Join Date: Sep 2008
Posts: 161
Default

Quote:
Originally Posted by Erel View Post
You can use ImageLib.StringWidth and ImageLib.StringHeight to estimate the size required to display a string.
Thanks for the tip. I decided to just works with 3 "pages" instead of showing it all on a single panel.
__________________
Reply With Quote
  #6 (permalink)  
Old 12-06-2008, 08:11 AM
Junior Member
 
Join Date: Nov 2008
Posts: 16
Default Multiline Textbox

How can you get a MultiLine Textbox without a vertical Scrollbar?
Reply With Quote
  #7 (permalink)  
Old 12-06-2008, 08:46 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

You can do it with the Door library.
Example in the attached program.

Best regards.
Attached Files
File Type: sbp TextBoxScrollBars.sbp (1.6 KB, 14 views)
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #8 (permalink)  
Old 12-06-2008, 01:21 PM
Junior Member
 
Join Date: Nov 2008
Posts: 16
Default

Thank you Klaus but I am having trouble implementing this. How would one go
about it on App Start just showing one textbox?
Reply With Quote
  #9 (permalink)  
Old 12-06-2008, 01:34 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Changing the text alignment of a textbox with FormLib.TextAlignment will also change it to a multiline textbox without scrollbars as a side effect.
So you can just change the alignment to left (which will have no effect on the alignment) and it will become a multiline textbox without scrollbars.
Reply With Quote
  #10 (permalink)  
Old 12-06-2008, 02:41 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Erel's solution is easier than what I proposed.

But the App_Start routine would look like this.
Code:
<font face="Courier New"><font size="2"><font face="Courier New"><font size="2">obj.New1(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080"><font face="Courier New"><font size="2"><font color="#800080">False</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
<font size=
"2"><font face="Courier New">obj.FromControl(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"TextBox1"</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font>
<font size=
"2"><font face="Courier New"><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">obj.SetProperty(</font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"ScrollBars"</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">,</font></font></font></font><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000"><font face="Courier New"><font size="2"><font color="#800000">"None"</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">)</font></font></font></font></font></font></font></font></font></font></font></font>
Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox.Text Average? cdeane Questions (Windows Mobile) 9 04-25-2008 06:25 PM
Focus text in textbox! superbabicka Questions (Windows Mobile) 5 04-01-2008 11:48 AM
Formating text in textbox Dr. Feelgood Questions (Windows Mobile) 1 03-06-2008 05:21 AM
Is it possible to open a JPEG and resize? tigme Questions (Windows Mobile) 5 02-19-2008 08:19 PM
Blank textbox.text value Cableguy Questions (Windows Mobile) 5 06-30-2007 08:58 PM


All times are GMT. The time now is 03:23 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0