You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Hugo Ferreira <hf...@gmail.com> on 2022/03/27 11:46:42 UTC
Strang error: I don't know what to import
Hi,
I added this method to DataGridView.as
public function scrollToIndex(index:int):Boolean
{
if (index == -1) return false;
var scrollArea:HTMLElement = listArea.element;
var oldScroll:Number = scrollArea.scrollTop;
var rowHeight:Number = _presentationModel.rowHeight;
var totalHeight:Number = sharedModel.dataProvider.length *
rowHeight - scrollArea.clientHeight;
scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);
return oldScroll != scrollArea.scrollTop;
}
When I try to compile (with ANT as always I do), I get this error:
[java]
/Volumes/Data/SDK/apache-royale-src/apache-royale/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as(191):
col: 19 Error: Type was not found or was not a compile-time constant:
HTMLElement.
[java]
[java] var scrollArea:HTMLElement = listArea.element;
[java]
The similar method works with ListView.as
Re: Strang error: I don't know what to import
Posted by Hugo Ferreira <hf...@gmail.com>.
It was that.
Thank you.
Yishay Weiss <yi...@hotmail.com> escreveu no dia domingo, 27/03/2022
à(s) 13:43:
> HTMLElement is only visible to JS targets so you need to wrap that up in a
> COMPILE::JS clause, e.g.
>
> COMPILE::JS {
> var scrollArea:HTMLElement = listArea.element;
> var oldScroll:Number = scrollArea.scrollTop;
>
> var rowHeight:Number = _presentationModel.rowHeight;
> var totalHeight:Number = sharedModel.dataProvider.length *
> rowHeight - scrollArea.clientHeight;
>
> scrollArea.scrollTop = Math.min(index * rowHeight,
> totalHeight);
>
> return oldScroll != scrollArea.scrollTop;
>
> }
>
> COMPILE::SWF {
> (…) // Jewel doesn’t really do swf, so maybe leave this out
> return false; // or true, a long as it’s a Boolean
> }
>
> From: Hugo Ferreira<ma...@gmail.com>
> Sent: Sunday, March 27, 2022 2:46 PM
> To: Apache Royale Development<ma...@royale.apache.org>
> Subject: Strang error: I don't know what to import
>
> Hi,
>
> I added this method to DataGridView.as
>
> public function scrollToIndex(index:int):Boolean
> {
> if (index == -1) return false;
>
> var scrollArea:HTMLElement = listArea.element;
> var oldScroll:Number = scrollArea.scrollTop;
>
> var rowHeight:Number = _presentationModel.rowHeight;
> var totalHeight:Number = sharedModel.dataProvider.length *
> rowHeight - scrollArea.clientHeight;
>
> scrollArea.scrollTop = Math.min(index * rowHeight,
> totalHeight);
>
> return oldScroll != scrollArea.scrollTop;
> }
>
> When I try to compile (with ANT as always I do), I get this error:
>
> [java]
>
> /Volumes/Data/SDK/apache-royale-src/apache-royale/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as(191):
> col: 19 Error: Type was not found or was not a compile-time constant:
> HTMLElement.
>
> [java]
>
> [java] var scrollArea:HTMLElement = listArea.element;
>
> [java]
>
>
> The similar method works with ListView.as
>
>
RE: Strang error: I don't know what to import
Posted by Yishay Weiss <yi...@hotmail.com>.
HTMLElement is only visible to JS targets so you need to wrap that up in a COMPILE::JS clause, e.g.
COMPILE::JS {
var scrollArea:HTMLElement = listArea.element;
var oldScroll:Number = scrollArea.scrollTop;
var rowHeight:Number = _presentationModel.rowHeight;
var totalHeight:Number = sharedModel.dataProvider.length *
rowHeight - scrollArea.clientHeight;
scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);
return oldScroll != scrollArea.scrollTop;
}
COMPILE::SWF {
(…) // Jewel doesn’t really do swf, so maybe leave this out
return false; // or true, a long as it’s a Boolean
}
From: Hugo Ferreira<ma...@gmail.com>
Sent: Sunday, March 27, 2022 2:46 PM
To: Apache Royale Development<ma...@royale.apache.org>
Subject: Strang error: I don't know what to import
Hi,
I added this method to DataGridView.as
public function scrollToIndex(index:int):Boolean
{
if (index == -1) return false;
var scrollArea:HTMLElement = listArea.element;
var oldScroll:Number = scrollArea.scrollTop;
var rowHeight:Number = _presentationModel.rowHeight;
var totalHeight:Number = sharedModel.dataProvider.length *
rowHeight - scrollArea.clientHeight;
scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);
return oldScroll != scrollArea.scrollTop;
}
When I try to compile (with ANT as always I do), I get this error:
[java]
/Volumes/Data/SDK/apache-royale-src/apache-royale/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/DataGridView.as(191):
col: 19 Error: Type was not found or was not a compile-time constant:
HTMLElement.
[java]
[java] var scrollArea:HTMLElement = listArea.element;
[java]
The similar method works with ListView.as