Jump to content

Search the Community

Showing results for tags 'wordwrap'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

There are no results to display.

Forums

  • Welcome to Smart Mobile Studio
    • News and Information
    • Pre-Sales Questions
    • Smart In the Media
    • Smart Contests
    • Meta
  • Smart Mobile Studio Discussion
    • General
    • IDE
    • RTL
    • Code
    • Client Server
    • Platform
    • Graphics
    • Deployment
    • Suggestion box
  • Smart Mobile Studio support
    • Support
    • Bug report
  • General Discussion
    • Pascal
    • Delphi
    • Javascript
    • HTML/HTML5
    • CSS
  • Resources
    • Website
    • Download Smart Mobile Studio

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Company name


Position

Found 3 results

  1. I need to be able to align text in a TLabel or TLabelText vertically, to it's container. I also need it to word wrap. I am particularly interested in using the label in a Layout, and therefor should align vertically to the layout when it is resized. I also need the text to word wrap based on the width of the layout (i.e. no ellipsis or clipping of text) What is the best way to go about this? I know for a DIV element, in HTML, i can do this <DIV style="height:100px; background-color: red; text-align: center; vertical-align: middle; line-height: 100px;"> This is how you align text in a div element both horizontally and Vertically </DIV> I attempted to create my own label(TsahLabel) by modifying the TW3Label fLabel:= TsahLabel.Create(self); fLabel.Caption:= 'I need to be able to align text in a TLabel or TLabelText vertically, to its container. I also need it to word wrap.' + 'I am particularly interested in using the label in a Layout, and therefor should align vertically to the layout when it is resized.' + 'I also need the text to word wrap based on the width of the layout (i.e. no ellipsis or clipping of text)'; w3_setStyle(FLabel.Container.Handle, 'background-color', 'white'); w3_setStyle(FLabel.Handle, 'background-color', 'red'); fLabel.AlignText:= taCenter; changing the TW3Label's Resize event from procedure TW3Label.Resize; var dx, dy: Integer; wd, hd: Integer; begin inherited; FContainer.BeginUpdate; FContainer.SetBounds(0,0,2,2); wd := ClampInt(FContainer.ScrollInfo.ScrollWidth + 2, 0, ClientWidth); hd := ClampInt(FContainer.ScrollInfo.ScrollHeight, 0, ClientHeight); case FTextAlign of taLeft: begin dy := (ClientHeight div 2) - (hd div 2); FContainer.SetBounds(0,dy,wd,hd); end; taCenter: begin dx := (ClientWidth div 2) - (wd div 2); dy := (ClientHeight div 2) - (hd div 2); FContainer.SetBounds(dx, dy, wd, hd); end; taRight: begin dx := ClientWidth - wd; dy := (ClientHeight div 2) - (hd div 2); FContainer.SetBounds(dx, dy, wd, hd); end; end; FContainer.EndUpdate; end; to procedure TsahLabel.Resize; begin inherited; FContainer.BeginUpdate; FContainer.SetBounds(0,0,ClientWidth,ClientHeight); //added by shane case FTextAlign of taLeft: begin W3_SetStyle(FContainer.Handle, 'text-align', 'left'); end; taCenter: begin W3_SetStyle(FContainer.Handle, 'text-align', 'center'); end; taRight: begin W3_SetStyle(FContainer.Handle, 'text-align', 'right'); end; end; FContainer.EndUpdate; end; and changing the IntializeObject method from procedure TW3Label.InitializeObject; begin inherited InitializeObject; FContainer := TW3LabelText.Create(Self); w3_setStyle(FContainer.Handle, 'white-space', 'nowrap'); w3_setStyle(FContainer.Handle, 'overflow', 'hidden'); w3_setStyle(FContainer.Handle, w3_CSSPrefixDef('vertical-align'), 'middle'); SetCaption('Label'); Height := 12; end; to procedure TsahLabel.InitializeObject; begin inherited InitializeObject; FContainer := TsahLabelText.Create(Self); w3_setStyle(FContainer.Handle, 'white-space', 'pre-wrap'); // ***** w3_setStyle(FContainer.Handle, 'overflow', 'hidden'); w3_setStyle(FContainer.Handle, w3_CSSPrefixDef('vertical-align'), 'middle'); SetCaption('Label'); Height := 12; end; however, im still getting ellipses and the align vertical is not working SCREENSHOT if I add the style line-height, then I can't calculate the correct pixel height based on my clientheight. e,g, w3_setStyle(FContainer.Handle, 'line-height', IntToStr(ClientHeight) + 'px'); which is NOT correct SCREENSHOT2
  2. I need to place a large amount of text that needs to be placed in a control and placed on my form. The text needs to able to be word wrapped and scroll-able. However, I do not want visible scrollbars such as seen in a TW3Memo. Can I use TW3ScrollControl for this? I have no idea how much text will be there, but at the most three large paragraphs. The text will need to word wrap based on the size of the control holding the text. I tried using a TW3Label but it seems it has no wrapping procedure TForm1.InitializeForm; var s: string; i: integer; begin inherited; // this is a good place to initialize components fScroll.SetBounds(0,0, ClientWidth, ClientHeight); fScroll.Content.SetBounds(0,0, clientWidth, clientHeight); fText.SetBounds(0,0, fScroll.clientWidth, fScroll.clientHeight); for i:= 1 to 10000 do s:= s + intToStr(i) + ' '; fText.Caption:= s; end; procedure TForm1.InitializeObject; begin inherited; {$I 'Form1:impl'} fScroll:= TW3ScrollControl.Create(self); fText:= TW3Label.Create(fScroll.Content); end; I then tried placing it in the scroll control's InnerHtml procedure TForm1.InitializeForm; var s: string; i: integer; begin inherited; // this is a good place to initialize components fScroll.SetBounds(0,0, ClientWidth, ClientHeight); fScroll.Content.SetBounds(0,0, clientWidth, clientHeight); for i:= 1 to 10000 do s:= s + intToStr(i) + ' '; fScroll.Content.InnerHTML:= '<html> <body> <p>' + S + '</p> </body> </html>';} end; that wraps, but does not scroll beyond the height of the scroll control. Again, I do not know the height of the text at any point, cause of the device size, layout, and amount of text wrapped within. If I set it to some arbitrary such as 5000, then i have extra area to scroll - with no text e.g. fScroll.Content.SetBounds(0,0, clientWidth, 5000); is there a way to place text in a scroll, make it wrap, and make it scroll to the end of its content without any extra space at end (well, there could be a little extra) here is my code here is my demo The #1 president has a large amount of text - so when viewed in a smaller device, or resized browser window, you will see my dilema thanx
  3. How to hide scrollbars on TW3Memo? Or, how do I display large amounts of text with word wrap, like in the memo? code https://github.com/holmesshanea/smartmobilestudio/tree/master/preZidents test https://rawgit.com/holmesshanea/smartmobilestudio/master/preZidents/www/index.html test in mobile http://ipadpeek.com/ just select the device and orientation (rotation) What I am trying to achieve is display a large amount of text (wordwrapped) and have it display - no matter the device and orientation - and be able to scroll through the text that isn't visible on the display. Preferably with no scrollbars as is shown with the memo control. Maybe I need to display the text in a div element instead?
×
×
  • Create New...