Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


DavidRM last won the day on September 23

DavidRM had the most liked content!

About DavidRM

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Tulsa, OK

Recent Profile Visitors

132 profile views
  1. DavidRM

    How to add a CSS file to a project?

    Add, Resource File(s), change it to "All FIles". Then you can select a CSS file.
  2. DavidRM

    Scrolling TW3ListBox in Code

    Thanks for the replies!
  3. DavidRM

    Scrolling TW3ListBox in Code

    Now investigating SmartCL.Flexbox.
  4. DavidRM

    Scrolling TW3ListBox in Code

    Not sure it matters anymore. TW3ListBox is built for fixed-height items, making it unsuitable to my purpose.
  5. DavidRM

    Scrolling TW3ListBox in Code

    Part of my boggle with SMS's controls is that they're *almost* like the controls in Delphi. But they're not. So my Delphi habits and approaches kick in (I've been using Delphi since v2 came out in 1996) and probably get in the way. I'm beginning to think SMS needs to take one of two courses on their UI controls: Fully embrace the Delphi model. As much as possible, even if it sacrifices performance, make the controls look/act/feel like the VCL. Ditch the VCL entirely. Get as close to the HTML5/CSS "metal" as possible, with a nice Object Pascal wrapper. In the meantime, I'll keep trying to puzzle out why the ScrollController.ScrollTo method doesn't act any different regardless of the values I pass in...
  6. DavidRM

    Scrolling TW3ListBox in Code

    How? Calling the ScrollController.ScrollTo isn't working. Clicking on the scrollbar works. I can drag it up and down. But I want to do this in code. Specifically, I want to add new items to the end of the list box, and have it display those. Unless the user has scrolled the box back (so its not at the bottom). Thanks. -David
  7. DavidRM

    TW3RegEx.Exec Error

    TW3RegEx.Exec can return NULL, but I can't test a TStrArray = nil. Compiler gets frowny with me. This was solved for TW3RegEx.Match: function TW3RegEx.Match(s: String): TStrArray; begin asm @Result = (@s).match(@Self.FRegEx); if (@Result===null) @Result=[]; end; end; TW3RegEx.Exec needs to be fixed in a similar way. -David
  8. DavidRM

    There's no SmartNJ.RegEx

    SmartCL.RegEx doesn't work in a NodeJS project. I was able to create one pretty easily, by copying-and-pasting the core of SmartCL.RegEx into a new unit. One that didn't use SmartCL.anything. -David
  9. DavidRM

    Setting Label Cursor

    I wanted a simple hyperlink. So I used a TW3Label, gave it caption, set the underline, gave it an OnClick event, etc. First, I discovered that setting the label's Font.Style to [fsUnderline] didn't work. Instead, I had to dig in the forums and learn to use TextNode.style. What's the point of the Font.Style property if it's not going to set the font style? Second: How do I set the mouse cursor? The "Cursor" property doesn't seem to be doing it. This is what I have: FForgotPassword := TW3Label.Create(Self); FForgotPassword.AutoSize := True; FForgotPassword.AlignText := taCenter; FForgotPassword.Transparent := False; FForgotPassword.Font.Color := clRed; FForgotPassword.Caption := 'Forgot Password?'; FForgotPassword.OnClick := ForgotPasswordClicked; FForgotPassword.TextNode.style.setProperty('text-decoration', 'underline'); FForgotPassword.Cursor := crPointer; On a whim, I just added this: FForgotPassword.TextNode.style.setProperty('cursor', 'pointer'); And that solves my problem. But now I want to know: Is there a reason those other properties exist? Is this a bug? Or am I missing something? Thanks. -David
  10. DavidRM

    Size of Components at Runtime

    OK. So even with "smart" positioning, the "spaces between" have to be calculated and accounted for. Thanks. -David
  11. DavidRM

    Size of Components at Runtime

    @jarto OK. How do I set the ClientWidth and ClientHeight without calculating all the padding and margins? For example: I need the ClientWidth of the panel to be wide enough to fit the text of the label. I need the ClientHeight of the panel to be tall enough to fit the label and a row of buttons. And, yes, I would like the current stylesheet to provide the margins and padding between the components. Thanks. -David
  12. DavidRM

    Size of Components at Runtime

    I'm arranging controls at runtime. But I can't seem to puzzle out what the actual size of a control is. I can find what it *says* it is (read the Height property for instance), but that seems to be only a guess or something. So what am I doing wrong here? procedure TShowMessageForm.UpdateUI; var tMetrics: TW3TextMetric; padding, border: integer; panelWidth, panelHeight, numButtons, buttonWidth, buttonLeft, buttonTotal: integer; begin var CSSHandle := TW3CustomBrowserAPI.GetComputedStylesFor(FMessagePanel.Handle); if (CSSHandle) then begin padding := w3_getPropertyAsInt(CSSHandle, 'paddingLeft'); border := w3_getPropertyAsInt(CSSHandle, 'borderLeft'); end else begin padding := 2; border := 2; end; FMessageLabel.Caption := FMessageText; tMetrics := FMessageLabel.MeasureText(FMessageText + 'XXX'); FMessageLabel.SetSize(border + padding + tMetrics.tmWidth + padding + border, border + padding + tMetrics.tmHeight + padding + border); FMessageLabel.Top := 0; FMessageLabel.Left := 0; panelWidth := (border + padding) + FMessageLabel.Width + (padding + border); panelHeight := (border + padding) + FMessageLabel.Height + (padding + border); if ButtonsVisible then begin numButtons := ButtonCount; buttonWidth := SizeButtons; buttonTotal := (buttonWidth * numButtons) + (padding * (numButtons - 1)); panelWidth := Max(panelWidth, (padding + border) + buttonTotal + (padding + border)); buttonLeft := (panelWidth - buttonTotal) div 2; if FMessageOKButton.Visible then begin FMessageOKButton.Left := buttonLeft; FMessageOKButton.Top := panelHeight + padding; Inc(buttonLeft, FMessageOKButton.Width + padding); end; if FMessageCancelButton.Visible then begin FMessageCancelButton.Left := buttonLeft; FMessageCancelButton.Top := panelHeight + padding; Inc(buttonLeft, FMessageCancelButton.Width + padding); end; panelHeight += FMessageOKButton.Height + padding; end; FMessagePanel.Width := panelWidth; FMessagePanel.Height := panelHeight; end; I'm guessing I'm going about adding in the padding and border widths wrong. The buttons are the worst offenders. Just because they *say* their X wide doesn't mean they are. They are *really* X+(some-random-effing-N). I appreciate any assistance. -David
  13. DavidRM

    ShowModal and Measuring Text

    In the ShowModal, the "init" callback is called before FormActivated is called. Thus, my calling UpdateUI in the init callback is... premature. By adding an OnActivated event handler to the ShowMessageForm, which calls UpdateUI (removing the call from the init callback), my original code works as expected. -David
  14. DavidRM

    ShowModal and Measuring Text

    I'm pretty certain it's something in the Application.ShowModal code this is the root of this issue.
  15. DavidRM

    ShowModal and Measuring Text

    That achieves *a* result but doesn't solve the problem. The first time through, MeasureText returns an actual result (as in, not 0,0). That allows the panel's SetBounds to do something. But never again. From thereon, it only returns 0,0. What's a decent workaround, do you figure? -David