CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Changing font size

by ScottWGast » 31 Oct 2014 20:35

Please check out the attached image. You can see that the various edit fonts are not the same font size.

testimage.jpg


I'm setting all of the component.Properties using this code:

Code: Select all
procedure TSweepstakesCampaign.Set_EntrantFieldProperties(EntrantField: TEntrantField; Container: TIWCGJQContainer; Parent: TWinControl);
begin

  Container.Parent := Parent;
  Container.Visible := Self.Get_EntrantFieldVisible(EntrantField);
  Container.Top := Self.Get_EntrantFieldTop(EntrantField);
  Container.Left := Self.Get_EntrantFieldLeft(EntrantField);
  Container.Width := Self.Get_EntrantFieldWidth(EntrantField);
  Container.Font.Size := Self.Get_EntrantFieldFontSize;
  Container.Height := Self.Get_EntrantFieldHeight;

end;



Self.Get_EntrantFieldFontSize returns 20.

All of the original components Font.Enabled = True.

Also, the controls StyleRenderOptions.RenderFont = True;

What do you think? I'd like all of the fonts to be the same as the Birth Date font.

Thanks,
Scott
You do not have the required permissions to view the files attached to this post.
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 03 Nov 2014 10:43

Hi Scott

Please you need to send us that dialog

Regards
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 03 Nov 2014 18:40

I don't have a little demo setup yet, but I have found that if I cast the IWCGJQContainer as TIWCGJQEdit (for those controls that are actually TIWCGJQEdit type), when I set the font.size value is set properly.

This is very curious... when in the IDE debugger:

Self.editFirstName.font.size equals 10
TIWCGJQContainer(Self.editFirstName).font.size equals 14 // this is the size I want

The TIWCGJQComboBoxEx and the TIWCGJQDatePicker both seem to retain the .Font.Size value set in the function (above in my original post) at run time.

So, what it seems to me is that if I set the .Font.Size on a TIWCGJQEdit when it is cast as a TIWCGJQContainer, the .Font.Size does not update the TIWCGJQEdit, but...

When I set the .Font.Size on a TIWCGJQDatePicker or a TIWCGJQComboBoxEx when it is cast as a TIWCGJQContainer, the .Font.Size DOES update the TIWCGJQDatePicker or TIWCGJQComboBoxEx.

I guess my question is this: When you are inheriting the TIWCGJQContainer for the TIWCGJQEdit control, do you do anything out of the ordinary with .Font.Size (or just the .Font, for that matter) that is different from when you are inheriting the TIWCGJQContainer for the DatePicker and ComboBoxEx?

Sorry for being so verbose!

Thanks,
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 03 Nov 2014 19:06

Hi Scott

I think the only problem is because you have to set Font.Enabled=True

But if you want to have your own font set, it's best if you make you own stylesheet (.css) file, make the page load it, through StyleSheet.URL (or .FileName) and uses the css classes in property Css.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 03 Nov 2014 19:23

I guess that I don't understand why, when I use Font.Enabled = True and I set the font.size on the ComboBox and DatePicker (cast as Container), the font.size is displayed correctly. But when I do the exact same thing on the Edit, the font.size does not display correctly (even though TIWCGJQContainer(Edit).Font.Size shows the correct value, while Edit.Font.Size does not.

I do not want to change all of the Font.Size instances in the application, just the few controls on this one page... and the Font.Size value will change, depending on the background graphics (in my test I'm showing the Daisy Fuentes sweepstakes)... graphics for a different sweepstakes will dictate a different Font.Size.

All of that being said, I can work around the problem by setting the Edit.Font.Size manually rather than having the function (in my first post) set the Font.Size. This will require must less work than creating a separate stylesheet for each sweepstakes event.

Just as a note of interest:

The other Container properties:
.Parent
.Top
.Left
.Height
.Width
are all being set at the same time as the Font.Size and all of those values are being retained by all of the inherited components (Edit, ComboBoxEx and DatePicker).

Thanks again for your help.
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 04 Nov 2014 12:03

Hi Scott,

When you call Set_EntrantFieldProperties procedure?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by ScottWGast » 04 Nov 2014 15:37

Hey Alexander! It's good to see that y'all have individual logins now :)

I'm calling Set_EntrantFieldProperties during my .Initialize procedure for the frame. (All of my frames have an .Initialize and .UnInitialize that I use after .Create and before .Destroy)

This is where I create / call the frame from my main form:
When the frame is a sweepstakes frame, I hide all of the various regions except for the background region and use the background region as the parent for the frame.

Code: Select all

  if Self.ActiveFrame = Include.C_FRAME_SWEEPSTAKES_CAMPAIGN then
    begin
      if not Assigned(Self.FframeSweepstakes) then
        begin
          Self.FframeSweepstakes := TframeSweepstakes.Create(Self);
          Self.FframeSweepstakes.Name := FindUniqueName;
          SetFrameParent(Self.FframeSweepstakes, Self.regionBackground);
          Self.FframeSweepstakes.Height := Self.regionBackground.Height;
          Self.FframeSweepstakes.Width := Self.regionBackground.Width;
          Self.FframeSweepstakes.Align := TAlign.alClient;
        end;
      Self.regionHeader.Visible := False;
      Self.regionFooter.Visible := False;
      Self.regionLeft.Visible := False;
      Self.regionRight.Visible := False;
      Self.regionMain.Visible := False;
      Self.regionHeader.RenderInvisibleControls := False;
      Self.regionFooter.RenderInvisibleControls := False;
      Self.regionLeft.RenderInvisibleControls := False;
      Self.regionRight.RenderInvisibleControls := False;
      Self.regionMain.RenderInvisibleControls := False;

      (Self.FframeSweepstakes as TframeSweepstakes).Visible := True;
      (Self.FframeSweepstakes as TframeSweepstakes).LockIndicator := Self.IWCGJQLockIndicator1;
      (Self.FframeSweepstakes as TframeSweepstakes).Initialize;

    end;



And here is my .Initialize code from the frame:

Code: Select all
procedure TframeSweepstakes.Initialize;
var
  slStates: TStringList;
  imagePanel: TIWCGJQImage;
  Panel: TIWCGJQCarouselPanel;
  strImageFilePath: String;
  i, c, iWidth, iHeight: Integer;
begin

  SetLength(Self.FSweepstakesPanels, Ord(High(TSweepstakesPanel)));

  // Initialize the frame
  Self.FSweepstakesCampaign := UserSession.CreateSweepstakesCampaign(UserSession.CurrentDomain);

  // set the Theme based on the sweepstakes campaign
  Self.ParentForm.StyleSheet.Filename := WebApplication.ApplicationPath + 'wwwroot\ui-themes\' + Self.FSweepstakesCampaign.WebTheme + '\jquery-ui.css';

  // make sure each control know who he is
  Self.editFirstName.Tag      := Ord(TEntrantField.efFirstName);
  Self.editLastName.Tag       := Ord(TEntrantField.efLastName);
  Self.editAddress1.Tag       := Ord(TEntrantField.efAddress1);
  Self.editAddress2.Tag       := Ord(TEntrantField.efAddress2);
  Self.editCity.Tag           := Ord(TEntrantField.efCity);
  Self.editStateProvince.Tag  := Ord(TEntrantField.efStateProvince);
  Self.editPostalCode.Tag     := Ord(TEntrantField.efPostalCode);
  Self.editPhone.Tag          := Ord(TEntrantField.efPhone);
  Self.editDOB.Tag            := Ord(TEntrantField.efDOB);
  Self.editEmailAddress.Tag   := Ord(TEntrantField.efEmail);
  Self.editEmailAddress2.Tag  := Ord(TEntrantField.efEmail2);
  Self.editPrivacyPolicy.Tag  := Ord(TEntrantField.efPrivacyPolicy);

  // add the edit controls to the SweepstakesCampaign object
  Self.FSweepstakesCampaign.EditControls.Add(Self.editFirstName);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editLastName);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editAddress1);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editAddress2);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editCity);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editStateProvince);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editPostalCode);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editPhone);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editDOB);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editEmailAddress);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editEmailAddress2);
  Self.FSweepstakesCampaign.EditControls.Add(Self.editPrivacyPolicy);

  for i := 0 to Ord(High(TSweepstakesPanel)) - 1 do
  begin
    strImageFilePath := '';
    case TSweepstakesPanel(i) of
      spPreview:  strImageFilePath := Self.FSweepstakesCampaign.PreviewImage;
      spAgeGate:  strImageFilePath := Self.FSweepstakesCampaign.AgeGateImage;
      spEntry:    strImageFilePath := Self.FSweepstakesCampaign.EntryImage;
      spThanks:   strImageFilePath := Self.FSweepstakesCampaign.ThanksImage;
      spEnded:    strImageFilePath := Self.FSweepstakesCampaign.EndedImage;
      spError:    strImageFilePath := Self.FSweepstakesCampaign.ErrorImage;
    end;

    if not S2Snax.IsEmptyString(strImageFilePath) then
      begin

        Panel:= Self.carouselPages.AddNewPanel;

        Self.FSweepstakesPanels[i] := Self.carouselPages.PanelCount - 1;

        Panel.Color:= Self.FSweepstakesCampaign.BGColor;
        Panel.HorzScrollBar.Visible := False;
        Panel.VertScrollBar.Visible := False;
        Panel.Tag := i;   // TSweepstakesPanel

        imagePanel := TIWCGJQImage.Create(Panel);
        imagePanel.Parent := Panel;
        imagePanel.Align := TAlign.alClient;
        imagePanel.Picture.Picture.LoadFromFile(strImageFilePath);

        iWidth := imagePanel.Picture.Width;
        iHeight := imagePanel.Picture.Height;

        if (TSweepstakesPanel(i) = TSweepstakesPanel.spEntry) then
          begin
////////////////////////////////////////////
/// HERE IS WHERE I CALL THE Set_EntrantFieldsProperties procedure
////////////////////////////////////////////
            Self.FSweepstakesCampaign.Set_EntrantFieldsProperties(imagePanel);
            Self.FSweepstakesCampaign.Set_SubmitButtonProperties(Self.buttonSubmit, imagePanel);
            Self.FSweepstakesCampaign.HideEntrantFields;
            TIWCGJQContainer(Self.FSweepstakesCampaign.EditControls[0]).SetFocus;
          end;
      end;
  end;

  carouselPages.Width := iWidth;
  carouselPages.Height := iHeight;

  Self.regionBackground.Color := Self.FSweepstakesCampaign.BGColor;

// Load up the State list
  Self.editStateProvince.Items.Clear;
  slStates := UserSession.GetSweepstakesStateList(Self.FSweepstakesCampaign);
  for i := 0 to slStates.Count - 1 do
    Self.editStateProvince.Items.AddOption(slStates[i], slStates[i], False);

  Self.FSweepstakesCampaign.ShowEntrantFields;
  Self.buttonSubmit.Visible := True;

end;



I can send you the frame and it's supporting .pas files if you would like to see all of the code.

Thanks!
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 04 Nov 2014 17:18

Hi ScottWGast,

I can't simulate this behavior...

Can we do remote support?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by ScottWGast » 04 Nov 2014 17:25

Sure!
I have Goto Meeting... do you want me to email you a link to join the meeting?

Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Alexander Bulei » 04 Nov 2014 17:28

Hi ScottWGast,

Do you have teamviewer? If yes, send us the id & pw...

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

Next

Return to General

Who is online

Users browsing this forum: No registered users and 9 guests

Contact Us.