Jump to content

uniChart gets garbled when changing visible property of a panel in the OnCreate method


vbdavie

Recommended Posts

Hello all;

 

I have had an issue for qute some time and just now figured out what's going on.

 

SYMPTOM:

A TuniChart line graphs looks garbled<junk> when some panels have their visible property changed in the main form's OnCreate method. If i remove these visible property changes from the OnCreate, then the uniChart looks perfect.

 

Very odd. It only happens to a chart sitting on a PageControl tabl. It does NOT happen to a chart sitting in TabControl tab. And it does NOT happen, when it's just sitting on the main form. Very wierd.

 

uniGUI ver 1.0.0.1385 (bug has existed for over a year)

FireFox (all versions that I've tested, including 52.1.0 <32bit> )

 

Another odd thing, is that it works on some older versions of InternetExplorer. Haven't tested on newer versions. AND it works on my latest CHROME version as well. It seems to be isolated with FireFox.

 

I have a ZIP file that contains the test project that shows the problem. But I don't know where to place the ZIP file. I thought I could just attach it to this message, but I don't see how to do it.

 

Darn, I can't find how to upload attachment. Here is the main.pas file

 

 

unit Main;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms, uniGUITypes, uniGUIAbstractClasses,

uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniButton, uniChart,

uniPageControl, uniTabControl, uniGUIBaseClasses, uniPanel, uniImage,

uniCheckBox, uniURLFrame, uniProgressBar, uniComboBox, uniSplitter,

uniBasicGrid, uniDBGrid, uniMultiItem, uniListBox, uniEdit, uniLabel,

uniGUIFrame, uniImageList, Vcl.Menus, uniMainMenu, uniToolBar,

uniBitBtn, uniTreeView, uniTimer, uniMemo;

 

type

TMainForm = class(TUniForm)

UniContainerPanelX: TUniContainerPanel;

UniPageControl1: TUniPageControl;

UniTabSheet1: TUniTabSheet;

UniPanel1: TUniPanel;

UniButton1: TUniButton;

BHideStuff: TUniButton;

UniButton3: TUniButton;

UniContainerPanel2: TUniContainerPanel;

UniPageControl2: TUniPageControl;

TSChartValuation: TUniTabSheet;

ChartValuation: TUniChart;

UniLineSeriesValTotal: TUniLineSeries;

UniChart1: TUniChart;

UniLineSeries1: TUniLineSeries;

UniTabControl1: TUniTabControl;

UniChart2: TUniChart;

UniLineSeries6: TUniLineSeries;

UniLabel1: TUniLabel;

UniTimer1: TUniTimer;

UniContainerPanel1: TUniContainerPanel;

UniMemo1: TUniMemo;

UniLabel2: TUniLabel;

procedure UniButton1Click(Sender: TObject);

procedure BHideStuffClick(Sender: TObject);

procedure UniButton3Click(Sender: TObject);

procedure UniFormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

procedure BuildCharts;

end;

 

function MainForm: TMainForm;

 

implementation

 

{$R *.dfm}

 

uses

uniGUIVars, MainModule, uniGUIApplication, ServerModule,

uniStrUtils, uniGUITheme, UniGUIJSUtils;

 

 

{

T H I S I S W H E R E T H E B U G I S

}

procedure TMainForm.UniFormCreate(Sender: TObject);

begin

UniContainerPanel1.Align:=alClient;

 

// REMOVE THE FOLLOWING TWO LINES AND THE PROBLEM GOES AWAY

// 1. When these lines are active, then the bottom chart doesn't build properly

// 2. When these lines are NOT active, then the bottom chart looks great, after clicking BUILD CHART button

uniContainerPanel2.Visible:=False;

uniContainerPanel1.Visible:=True;

end;

 

function MainForm: TMainForm;

begin

Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));

end;

 

procedure TMainForm.BHideStuffClick(Sender: TObject);

begin

uniContainerPanel2.Visible:=True;

uniContainerPanel1.Visible:=False;

 

end;

 

procedure TMainForm.UniButton1Click(Sender: TObject);

begin

BuildCharts;

 

end;

 

procedure TMainForm.UniButton3Click(Sender: TObject);

begin

uniContainerPanel2.Visible:=False;

uniContainerPanel1.Visible:=True;

 

end;

 

procedure TMainForm.BuildCharts;

Var

X:Integer;

begin

UniLineSeriesValTotal.Clear;

UniLineSeries1.Clear;

UniLineSeries6.Clear;

For X:=1 To 30 Do

Begin

UniLineSeriesValTotal.Add(Random(100)*1000,'L:'+IntToStr(X));

UniLineSeries1.Add(Random(100)*1000,'L:'+IntToStr(X));

UniLineSeries6.Add(Random(100)*1000,'L:'+IntToStr(X));

End;

end;

 

initialization

RegisterAppFormClass(TMainForm);

 

end.

 

And here is the main.dfm file...

 

object MainForm: TMainForm

Left = 219

Top = 197

ClientHeight = 634

ClientWidth = 771

Caption = 'MainForm'

OldCreateOrder = False

MonitoredKeys.Keys = <>

OnCreate = UniFormCreate

PixelsPerInch = 96

TextHeight = 13

object UniContainerPanelX: TUniContainerPanel

Left = 0

Top = 0

Width = 771

Height = 634

Hint = ''

ParentColor = False

Align = alClient

Anchors = [akLeft, akTop, akRight, akBottom]

TabOrder = 0

ExplicitLeft = 203

ExplicitTop = -14

ExplicitWidth = 792

ExplicitHeight = 844

object UniPageControl1: TUniPageControl

Left = 0

Top = 0

Width = 771

Height = 634

Hint = ''

ActivePage = UniTabSheet1

Align = alClient

Anchors = [akLeft, akTop, akRight, akBottom]

TabOrder = 0

ExplicitTop = 41

ExplicitWidth = 705

ExplicitHeight = 617

object UniTabSheet1: TUniTabSheet

Hint = ''

Caption = 'Main'

ExplicitLeft = 0

ExplicitTop = 0

ExplicitWidth = 256

ExplicitHeight = 128

object UniPanel1: TUniPanel

Left = 0

Top = 0

Width = 763

Height = 52

Hint = ''

Align = alTop

Anchors = [akLeft, akTop, akRight]

TabOrder = 0

Caption = ''

object UniButton1: TUniButton

Left = 8

Top = 25

Width = 161

Height = 25

Hint = ''

Caption = 'Make 3 charts to SHOW BUG'

TabOrder = 1

ScreenMask.Enabled = True

OnClick = UniButton1Click

end

object BHideStuff: TUniButton

Left = 184

Top = 25

Width = 113

Height = 25

Hint = ''

Caption = 'SHOW CHARTS'

TabOrder = 2

ScreenMask.Enabled = True

OnClick = BHideStuffClick

end

object UniButton3: TUniButton

Left = 312

Top = 25

Width = 97

Height = 25

Hint = ''

Caption = 'HIDE CHARTS'

TabOrder = 3

ScreenMask.Enabled = True

OnClick = UniButton3Click

end

object UniLabel2: TUniLabel

Left = 16

Top = 4

Width = 715

Height = 13

Hint = ''

Caption =

'1) Click MAKE CHARTS, 2) Click SHOW CHARTS, 3) You will see that' +

' the bottom chart is messed up., 4) Please read memo text on rig' +

'ht side of screen'

TabOrder = 4

end

end

object UniContainerPanel2: TUniContainerPanel

Left = 0

Top = 52

Width = 763

Height = 554

Hint = ''

ParentColor = False

Color = clSkyBlue

Align = alClient

Anchors = [akLeft, akTop, akRight, akBottom]

ScreenMask.Message = 'Loading...'

TabOrder = 1

ExplicitLeft = 8

ExplicitTop = 42

ExplicitWidth = 834

ExplicitHeight = 631

object UniPageControl2: TUniPageControl

Left = 0

Top = 371

Width = 763

Height = 183

Hint = ''

ActivePage = TSChartValuation

Align = alBottom

Anchors = [akLeft, akRight, akBottom]

TabOrder = 1

object TSChartValuation: TUniTabSheet

Hint = ''

Caption = 'THIS CHART IS MESSED UP'

Font.Height = -13

ParentFont = False

object ChartValuation: TUniChart

Left = 8

Top = 8

Width = 377

Height = 145

Hint = ''

Title.Text.Strings = (

'Account Valuation')

Legend.Font.Height = -15

Legend.Font.Style = [fsBold, fsUnderline]

LayoutConfig.BodyPadding = '10'

ScreenMask.Enabled = True

TitleAlign = taCenter

object UniLineSeriesValTotal: TUniLineSeries

Title = 'Stocks'

end

end

end

end

object UniChart1: TUniChart

Left = 16

Top = 32

Width = 385

Height = 145

Hint = ''

Title.Text.Strings = (

'Account Valuation')

Legend.Font.Height = -15

Legend.Font.Style = [fsBold, fsUnderline]

LayoutConfig.BodyPadding = '10'

ScreenMask.Enabled = True

TitleAlign = taCenter

object UniLineSeries1: TUniLineSeries

Title = 'Stocks'

end

end

object UniTabControl1: TUniTabControl

Left = 16

Top = 184

Width = 393

Height = 177

Hint = ''

Tabs.Strings = (

'THIS CHART IS GOOD'

'Tab 2')

TabOrder = 3

object UniChart2: TUniChart

Left = 8

Top = 24

Width = 369

Height = 145

Hint = ''

Title.Text.Strings = (

'Account Valuation')

Legend.Font.Height = -15

Legend.Font.Style = [fsBold, fsUnderline]

LayoutConfig.BodyPadding = '10'

ScreenMask.Enabled = True

TitleAlign = taCenter

object UniLineSeries6: TUniLineSeries

Title = 'Stocks'

end

end

end

object UniLabel1: TUniLabel

Left = 24

Top = 8

Width = 164

Height = 19

Hint = ''

Caption = 'THIS CHART IS GOOD'

ParentFont = False

Font.Height = -16

TabOrder = 4

end

object UniContainerPanel1: TUniContainerPanel

Left = 408

Top = 8

Width = 217

Height = 46

Hint = ''

ParentColor = False

Color = clWhite

TabOrder = 5

end

object UniMemo1: TUniMemo

Left = 416

Top = 60

Width = 337

Height = 305

Hint = ''

Lines.Strings = (

 

'It appears that when you set the visible propery for some panels' +

' in the ONCREATE method, it messes up the bottom chart that is s' +

'itting in a PageControl. The other two charts don'#39't appeart to b' +

'e bothered.'

''

 

'If I remove the panel visible property changes and put them into' +

' a uniTimer or some other buttonClick, then it appears to work f' +

'ine.'

''

 

'Very wierd that it only blows up when I attempt to do it in the ' +

'OnCreate method.'

''

 

'Also, wierd that it only happens to the chart sitting in the Pag' +

'eControl.'

''

'Can someone figure this out?'

'Thanks'

'Davie')

ParentFont = False

Font.Height = -13

TabOrder = 6

end

end

end

end

end

object UniTimer1: TUniTimer

Interval = 1

RunOnce = True

ClientEvent.Strings = (

'function(sender)'

'{'

' '

'}')

Left = 472

Top = 8

end

end

 

 

 

I wonder if anybody knows what's going on with this strange interaction.

 

Thanks

Davie

Link to comment
Share on other sites

Hi,

 

** I have a ZIP file that contains the test project that shows the problem. But I don't know where to place the ZIP file. I thought I could just attach it to this message, but I don't see how to do it.

 

Which edition are you using?!

 

Best regards.

Link to comment
Share on other sites

As mentioned prior, it's uniGUI version 1.0.0.1385

I didn't mention that it's TRIAL, so maybe that makes a diff, don't know.

 

When I was talking about the ZIP file, I was refering to the fact that I wanted to attach a ZIP file to my posted message. I couldn't see how to do that in the forum's editor. That is why I copied/pasted all the source code into the message page.

 

Thanks for looking into this.

 

Davie

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...