Jump to content

RobYost

uniGUI Subscriber
  • Posts

    207
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by RobYost

  1. You might have renamed mainmodule.  If you did you need to change the references to it in other forms to what ever you renamed it to.

     

    I change mine to mm:

    function fmMain: TfmMain;
    begin
      Result := TfmMain(mm.GetFormInstance(TfmMain));
    end;
  2. I found this on StackOverflow:

    procedure FillStringgrid;
    // Split the line of text into individual entries
      procedure Split(const Delimiter: Char; Input: string; const Strings: TStrings);
      begin
        Assert(Assigned(Strings));
        Strings.Clear;
        Strings.Delimiter     := Delimiter;
        Strings.DelimitedText := Input;
      end;
    
    
    var
      strlst: Tstringlist;
      myfile: TextFile;
      search: string;
      i, j  : Integer;
    begin
      i := 0;
      AssignFile(myfile, 'filepath'); // specify your file path here
      Reset(myfile);
      while not Eof(myfile) do
      begin
        Readln(myfile, search);
        strlst := Tstringlist.Create;
        Split(' ', search, strlst); // get the no's separated by the delimiter
        // adjust your column count based on no of entries
        if StringGrid1.ColCount < strlst.Count then
          StringGrid1.ColCount := strlst.Count;
        StringGrid1.rows[i]    := strlst; // adjust the row count
        inc(i);
        StringGrid1.RowCount := i;
      end;
      // free stringlist and textfile
      CloseFile(myfile);
      strlst.Free;
    
    
      // fill in the blank entries with 0
      for i := 0 to StringGrid1.RowCount - 1 do
      begin
        for j := 0 to StringGrid1.ColCount - 1 do
        begin
          if StringGrid1.Cells[j, i] = '' then
            StringGrid1.Cells[j, i] := '0';
        end;
      end;
    end;
  3. I added the HTML to the HTMLFrame, CustomCSS, customFiles and the BeforeInit Code.
     
    Under Files I added a folder css and put the css file I downloaded in it.  Then I removed the @import line.
    Then I created a folder font under files and put the file fontawesome-webfont.eot
     
    But I still just get the little squares instead of stars. I must not have followed your instructions quite right.

     

    I have a link to the project file I used:

     

    http://propertysidekick.com/public/Stars.zip

     

    I still don't know how to upload a file.

  4. I found an example on the internet that seems to work. (https://codepen.io/jamesbarnett/pen/vlpkh)

    in a HTMLFrame:

    <h1>Pure CSS Star Rating Widget</h1>
    <fieldset class="rating">
        <input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label>
        <input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
        <input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label>
        <input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label>
        <input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label>
        <input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
        <input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
        <input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
        <input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1" title="Sucks big time - 1 star"></label>
        <input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
    </fieldset>

    in customeCSS:

    @import url(//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);
    
    fieldset, label { margin: 0; padding: 0; }
    body{ margin: 20px; }
    h1 { font-size: 1.5em; margin: 10px; }
    
    /****** Style Star Rating Widget *****/
    .rating { 
      border: none;
      float: left;
    }
    .rating > input { display: none; } 
    .rating > label:before { 
      margin: 5px;
      font-size: 1.25em;
      font-family: FontAwesome;
      display: inline-block;
      content: "\f005";
    }.rating > .half:before { 
      content: "\f089";
      position: absolute;
    }.rating > label { 
      color: #ddd; 
     float: right; 
    }
    
    /***** CSS Magic to Highlight Stars on Hover *****/
    .rating > input:checked ~ label, /* show gold star when clicked */
    .rating:not(:checked) > label:hover, /* hover current star */
    .rating:not(:checked) > label:hover ~ label { color: #FFD700;  } /* hover previous stars in list */
    
    .rating > input:checked + label:hover, /* hover current star when changing rating */
    .rating > input:checked ~ label:hover,
    .rating > label:hover ~ input:checked ~ label, /* lighten current selection */
    .rating > input:checked ~ label:hover ~ label { color: #FFED85;  } 

    But I don't like that the css file is not on my server.  So I downloaded it. 

    But I am unsure where to put it or how to change the reference to it

    in font-awesome.css:
    @import url(//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);

    Also netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css references:

    src: url('../font/fontawesome-webfont.eot?v=3.2.1');

    It looks like I should  create 2 folders in the files directory:

    css

    font

    and put font-awesome.css in css

    and put fontawesome-webfont.eot in font

     

    if I do that what should the @import line look like?

     

     

     

  5. Are you doing this to create an app that just goes to your Unigui app?  Just a couple lines of code that sets the URL then opens?

     

    If so does it work well?  Are you able to create an iOS app?  I don't have the latest version of XE (I have XE6) so I can't a mobile app for the current Android phones. So I used AppsGeyser, which works pretty well but can not make an iOS app.

     

    One issue I have with the app is that if I click log out I go to:

      UniApplication.Restart;

    Which work with my browser (goes back to the login screen) but in the app goes to the:

    "Invalid session or session timeout. restart Application". message

     

    Does this happen with your application?

  6. source: https://unigui.miraheze.org/wiki/Main_Page

     

    I have created two new controls descended from TUnimEdit and TUnimLabel.

     

    added:

    • Font size
    • Font color
    • Font style (Bold, Italics)
    • border size
    • border color

    I tried to accomplish this with code like this:

      s := ' document.getElementById("' + edt1.JSName + '_id").style.fontsize = "8px"; ';               // Not works
      UniSession.AddJS(s);

    But "Delphi Developer" told me some CSS properties can not be changed and I would need to make the changes with CustomCSS

     

    This is more limited because I can't do things like:

    s := ' document.getElementById("' + edt1.JSName + '_id").style.fontsize = "'IntToStr(FFont.size) + 'px"; ';   

    I have to add all combinations I will need to the CSS:

    .fontsize12 {
    font-size: 12px;
    } .fontsize14 {
    font-size: 14px;
    }

    I created a wiki with the two new components and the CustomCSS file.

    Please take a look and make any changes you can think of to make it better.

     

    I would rather do the styles in code instead of with CSS file, but I couldn't make it work.  I am not done, but I thought it might be good for someone else to look at it in case there are some basic changes that could be made to make it better.

    • Upvote 1
  7. Thank you, I got that working and have started a new control to use it. I will share it when I am done.

     

    Here is what I have so far:   https://unigui.miraheze.org/wiki/Main_Page  (it is not done)

     

    I am trying to add border-width and border-color.  Is there any documentation that shows how to use JSConfig.

     

    When I look at https://www.w3schools.com  to look at how to format JS I see that examples like:

    document.getElementById("myP").style.fontFamily = "Impact,Charcoal,sans-serif";

     

     

    But in CustomCSS I need to use font-family. So is there somewhere where I can see what the expected input for a CSS? Not just for font-family.

     

    For example JSConfig('inputCls', [something]);  

    this works for TUnimEdit but not for TUnimLabel.  It makes sense label is not an input class, but what is it?  It tried: JSConfig('text', [something]); but that didn't work, and I don;t know how to look it up

     

    ALSO.

     

    in JSConfig your example for the first parameter is 'inpoutCls' and 'cls'  what is the difference and there seems to more options, where can I look up what I can use for the first parameter?  What parameter goes with border-width and border-color?

  8. Is it possible to add the clientevent code in my Delphi code?  I would like to not have to put this information in every edit field, I would like to call a function that loops through all components.

     

    But thank you I will try your suggestions.

     

    I don't see how to attach so I am just putting in the source code.

     

    unit Mainm;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, uniGUIFont,
      Controls, Forms, uniGUITypes, uniGUIAbstractClasses,
      uniGUIClasses, uniGUImClasses, uniGUIRegClasses, uniGUIForm, uniGUImForm, uniGUImJSForm, uniEdit, unimEdit, uniGUIBaseClasses, uniLabel,
      unimLabel, unimPanel;
    
    type
      TmUniXLabel = class(TUnimLabel)
      published
        property Font;
      end;
    
      TmUniXEdit = class(TUnimEdit)
      published
        property Font;
      end;
    
      TMainmForm = class(TUnimForm)
        lbl1: TUnimLabel;
        edt1: TUnimEdit;
        pnl1: TUnimPanel;
        procedure UnimFormShow(Sender: TObject);
        procedure UnimFormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
        xLabel: TmUniXLabel;
        xEdit : TmUniXEdit;
      end;
    
    function MainmForm: TMainmForm;
    
    implementation
    
    {$R *.dfm}
    
    uses
      uniGUIVars, MainModule, uniGUIApplication;
    
    function MainmForm: TMainmForm;
    begin
      Result := TMainmForm(UniMainModule.GetFormInstance(TMainmForm));
    end;
    
    procedure TMainmForm.UnimFormCreate(Sender: TObject);
    begin
      xLabel := TmUniXLabel.Create(self);
    
      xLabel.Parent  := pnl1;
      xLabel.Top     := 0;
      xLabel.Left    := 0;
      xLabel.Width   := 100;
      xLabel.Caption := 'xLabel';
    
      xLabel.Font.Size  := 9;                          //works
      xLabel.Font.Style := [fsBold];                   //works
      xLabel.Font.Color := clGreen;                    //works
      xLabel.Font.Name := 'Comic Sans MS';             //works
    
      xEdit := TmUniXEdit.Create(self);
    
      xEdit.Parent := pnl1;
      xEdit.Top    := 50;
      xEdit.Left   := 0;
      xEdit.Width  := 100;
      xEdit.Text   := 'xEdit';
    
      xEdit.Font.Size  := 9;                              // Not works
      xEdit.Font.Style := [fsBold];                       // Not works
      xEdit.Font.Color := clGreen;                        // Not works
      xEdit.Font.Name := 'Comic Sans MS';                 // Not works
    
    end;
    
    procedure TMainmForm.UnimFormShow(Sender: TObject);
    var
      s: String;
    begin
      // ==========================================================================================
      //  TUnimLabel
      // ==========================================================================================
      s := ' document.getElementById("' + lbl1.JSName + '_id").style.border = "3px solid red"; ';        //works
      UniSession.AddJS(s);
    
      s := ' document.getElementById("' + lbl1.JSName + '_id").style.fontsize = "8px"; ';                //works
      UniSession.AddJS(s);
    
      s := ' document.getElementById("' + lbl1.JSName + '_id").style.color = "green"; ';                //works
      UniSession.AddJS(s);
    
      s := ' document.getElementById("' + lbl1.JSName + '_id").style.fontfamily = "Cambria"; ';         // Not works
      UniSession.AddJS(s);
    
      // ==========================================================================================
      //  TUnimEdit
      // ==========================================================================================
      s := ' document.getElementById("' + edt1.JSName + '_id").style.border = "3px solid red"; ';       //works
      UniSession.AddJS(s);
    
      s := ' document.getElementById("' + edt1.JSName + '_id").style.fontsize = "8px"; ';               // Not works
      UniSession.AddJS(s);
    
      s := ' document.getElementById("' + edt1.JSName + '_id").style.fontfamily = "Cambria"; ';         // Not works
      UniSession.AddJS(s);
    
      s := ' document.getElementById("' + edt1.JSName + '_id").style.color = "green"; ';                // Not works
      UniSession.AddJS(s);
    end;
    
    initialization
    
    RegisterAppFormClass(TMainmForm);
    
    end.
    object MainmForm: TMainmForm
      Left = 0
      Top = 0
      ClientHeight = 480
      ClientWidth = 320
      Caption = 'MainmForm'
      OnShow = UnimFormShow
      TitleButtons = <>
      OnCreate = UnimFormCreate
      PixelsPerInch = 96
      TextHeight = 13
      ScrollPosition = 0
      ScrollHeight = 47
      PlatformData = {}
      object lbl1: TUnimLabel
        Left = 72
        Top = 33
        Width = 85
        Height = 23
        Hint = ''
        AutoSize = False
        Caption = 'lbl1'
      end
      object edt1: TUnimEdit
        Left = 72
        Top = 77
        Width = 154
        Height = 47
        Hint = ''
        Text = 'edt1'
      end
      object pnl1: TUnimPanel
        Left = 24
        Top = 192
        Width = 256
        Height = 128
        Hint = ''
      end
    end
    
  9. Some of style commands don't work for me.  Am I doing something wrong or is there a problem

     

     

    //TUnimLabel

    WORKS

      s := ' document.getElementById("' + mUniRyLabel1.JSName + '_id").style.border = "3px solid red"; ';
      UniSession.AddJS(s);
     

    WORKS

      s := ' document.getElementById("' + mUniRyLabel1.JSName + '_id").style.color = "red"; ';
      UniSession.AddJS(s);

    DOESN"T WORK - But I can make it work by adding  "Property Font" to a TUnimLabel descendant

      s := ' document.getElementById("' + mUniRyLabel1.JSName + '_id").style.fontfamily = "Cambria"; ';
      UniSession.AddJS(s);

    ----------------------------------------------------------------------------------------------------------------------------------------------

     
    //TUnimEdit
     
     
     

    WORKS

      s := ' document.getElementById("' + edt1.JSName + '_id").style.border = "3px solid green"; ';
      UniSession.AddJS(s);
     

    DOESN"T WORK

      s := ' document.getElementById("' + edt1.JSName + '_id").style.fontsize = "10px"; ';
      UniSession.AddJS(s);
     

    DOESN"T WORK  - Can NOT make it work by adding  "Property Font" to a TUnimEdit descendant (which does work with TUnimLabel)

      s := ' document.getElementById("' + edt1.JSName + '_id").style.fontfamily = "Cambria"; ';
      UniSession.AddJS(s);
     

    DOESN"T WORK

      s := ' document.getElementById("' + edt1.JSName + '_id").style.color = "green"; ';
      UniSession.AddJS(s);
    
     
  10. Thanks that works.

     

    I was creating the label at runtime, here's how I did it if anyone wants to know.

     

        while ds.EOF = False do
        begin
          lblToPay[i]         := TUnimLabel.Create(ts2);
          lblToPay[i].Parent  := ts2;
          lblToPay[i].Caption := fmtCur('0');
          lblToPay[i].Tag     := i;
          lblToPay[i].Height  := 16;
          lblToPay[i].Left    := lblHeaderToPay.Left;
          lblToPay[i].Top     := curTop;
          lblToPay[i].OnClick := UnpaidClick;
          lblToPay[i].ClientEvents.UniEvents.Clear;
          lblToPay[i].ClientEvents.UniEvents.Add
            ('afterCreate=function afterCreate(sender) '#13#10'{'#13#10'    var me = sender;'#13#10'    me.element.on("tap",'#13#10'        function() {'#13#10'               me.fireEvent("click");'#13#10'        }'#13#10'    )'#13#10'}');
          totDue := totDue + 0;
          curTop := curTop + rowHeight;
          i      := i + 1;
          ds.Next;
        end;
    • Upvote 1
  11. Mobile:

    I want to enter a currency field.  What should I use?

    How do I format it?

     

    The mobile controls are missing some basic properties:

    Font

    Alignment

    BorderStyle

    FormattedInput

     

    I would like to have these properties, and I am willing to help add them.  Is there anything I/we could do to help add these to the standard controls or make a descendant?

     

     

    I know how to get around the font/alignment/borderstyle

    But I do not know what to do about FormattedInput.  (How to enter currency)

  12. David:

    I have my program running twice on my server:

     

    https://demo.simple-landlord.com

    http://demo.simple-landlor.com:8000

     

    your app works if I use the IP:8000

    but does not work if I try the secure option.

     

    Oddly enough it does not show my icons on my treeview, but does if I use a web page to access it.

     

    Mohammad:

    I tried android studio and found a project that goes to a web page via a web view.

    It will go to google.com but not my website either HTTPS or HTTP

  13. I bought a Positive SSL Wildcard Certificate from SSLPoint (reseller of Comodo) for $89/year.

     

    You receive from Comodo:

    • Root CA Certificate - AddTrustExternalCARoot.crt
    • Intermediate CA Certificate - COMODORSAAddTrustCA.crt
    • Intermediate CA Certificate - COMODORSADomainValidationSecureServerCA.crt
    • Your PositiveSSL Wildcard Certificate - STAR_simple-landlord_com.crt  (your domain here)

     

    rename STAR_simple-landlord_com.crt to cert.pem

     

    concatenate (just in notepad) together:

    AddTrustExternalCARoot.crt

       COMODORSAAddTrustCA.crt
       COMODORSADomainValidationSecureServerCA.crt

     

    in this order and save to root.pem

     

    Key.pem you need to create on your server UniGui already has good instructions for this:

    http://www.unigui.com/doc/online_help/getting-a-ssl-certificate-from.htm

     

    I hope this helps someone

    • Like 1
    • Upvote 6
  14. I want to create an app that just displays my mobile website (unigui)

     

    I downloaded Android Studio and created an app that opens google.com but when I change it to my website the screen just stays blank.

     

    Has someone else already done this?  Is it easier to use Cordova or PhoneGap?

     

    Your input would be appreciated.

×
×
  • Create New...