Jump to content

Search the Community

Showing results for tags 'tw3label'.



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 4 results

  1. IElite

    TLabelEdit

    I needed a component that made it easier to place a lot of labels and TEdit controls on a form. So, I wrote this simple version of a TLabelEdit component it has the following public properties: property Label: TW3Label read fLabel; property Edit: TW3EditBox read fEdit; property Spacing: Integer read fSpacing write fSpacing; property Margins: Integer read fMargins write fMargins; Spacing - space between the Label and edit control only Margins - space on outside boundary of both the label and edit controls (i.e. space on left, right of both Label and Edit, as well as top of label and bottom of edit). example run-time creation code: fLabelEdit:= TLabelEdit.Create(self); fLabelEdit.Handle.style.setProperty('background-color', 'white'); fLabelEdit.Label.Handle.style.setProperty('background-color', 'Red'); fLabelEdit.Edit.Handle.style.setProperty('color', 'red'); fLabelEdit.Left:= 10; fLabelEdit.Top:= 10; fLabelEdit.Width:= 128; fLabelEdit.Height:= 64; fLabelEdit.Margins:= 2; fLabelEdit.Spacing:= 2; Full unit code below. Let me know if you see anything that can be improved. Shane unit LabelEdit; interface uses SmartCL.System, System.Colors, SmartCL.Components, SmartCL.Controls; type TLabelEdit = class(TW3CustomControl) private fLabel: TW3Label; fEdit: TW3EditBox; fSpacing: Integer; fMargins: Integer; protected procedure Resize; override; procedure InitializeObject; override; procedure FinalizeObject; override; public property Label: TW3Label read fLabel; property Edit: TW3EditBox read fEdit; property Spacing: Integer read fSpacing write fSpacing; property Margins: Integer read fMargins write fMargins; end; implementation procedure TLabelEdit.InitializeObject; begin inherited; Height:= 64; Width:= 128; Spacing:= 0; Margins:= 0; FLabel := TW3Label.Create(Self); FLabel.Font.Name := 'verdana'; FLabel.Font.Color := RGBToColor($FF, $FF, $FF); FLabel.Font.Weight := 'bold'; FLabel.Font.Size := 18; FLabel.Caption := ClassName; FLabel.AlignText := taLeft; FEdit := TW3EditBox.Create(Self); end; procedure TLabelEdit.FinalizeObject; begin FLabel.Free; FEdit.Free; inherited; end; procedure TLabelEdit.Resize; begin inherited; fLabel.SetBounds(fMargins, fMargins, clientWidth-(fMargins * 2), (clientHeight Div 2)-(fMargins * 2)); fEdit.SetBounds(fMargins, (fLabel.Top + fLabel.Height) + fSpacing + fMargins, clientwidth-(fMargins * 2), (clientHeight Div 2) - (fMargins * 2) - (fSpacing)); end; end.
  2. 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
  3. How to change the style of a TW3Header text? .lblHeader{ color: #005CB9; } If I drop a TW3Label on the form and set its StyleClass = lblHeader'; it works fine however, if I try to change the Style class of the one on the headercontrol, it doesn't work W3HeaderControl1.Title.StyleClass:= 'lblHeader'; I have tried it in both the InitializeForm and InitializeObjects methods and nothing! thanks
  4. I have encountered some strange things, I am not sure these are bugs or not. 1-) I use Application.GotoForm(FrmXXXX, fefromright) to navigate another forms and it works fine but if I use fenone parameter, SMS navigates me to a different form !!! 2-) I have created my own tw3panel class (tw3mypanel) and has 4 tw3mybutton class which has own Tw3label. For example there are 2 tmyw3panel object on form1 and when I navigate back to form1 from form2 tw3labels on tw3mypanel disappear and buttons on tw3mypanel move to different locations from I set on create event !!! There are total 5 forms in my project (Include Main form). I use beta5
×