Ok, I fiddled with this a bit more and found a better way to apply the
multiple inheritance:
Modify the constructor in the file "scripts/js/real/code/r3progm.js" to
look something like this:
function r3Progressmodel () {
this.base = r3God;
if(arguments.length) {
this.base(R3CLID_PROGRESSMODEL, arguments);
}
r3Progre.apply(this); // Patch up multiple inheritance missed by autogen
script / fre_ber 20140315
// Methods
// Attributes
this.GetStartTime=GetR3PROGMODA_StartTime;
this.GetInProgress=GetR3PROGMODA_InProgress;
this.GetCancelled=GetR3PROGMODA_Cancelled;
this.SetCancelled=SetR3PROGMODA_Cancelled;
this.GetInfoStringShort=GetR3PROGMODA_InfoStringShort;
this.GetForceRefresh=GetR3PROGMODA_ForceRefresh;
this.SetEventHook=SetR3PROGMODA_EventHook;
}
My original file is from RS v6.1, yours might look different, the key thing
is the added "r3Progre.apply(this);".
After that change this code works for me:
// Includes
------------------------------------------------------------------
include("oops/r3window.js");
include("oops/r3packer.js");
include("oops/r3button.js");
include("oops/r3text.js");
include("real/gadget/r3progd.js");
include("real/code/r3progm.js");
// Variable declarations
-----------------------------------------------------
myWindow = new Object;
myPacker = new Object;
myButton = new Object;
myInfo = new Object;
myProgressgadget = new Object;
workTarget = 20000
// Function definitions
------------------------------------------------------
function Progress_work()
{
for(i = 0; i < workTarget; i++)
{
myInfo.SetText("work =" + i);
myProgressgadget.SHOWTEXT("work =" + i + " :");
myProgressgadget.PROGRESSTO(i);
}
}
// Handler for button to execute scriput.
function ButtonExecute()
{
myInfo.SetText("Start");
myProgressgadget.RESET();
myProgressgadget.SHOWTEXT("Start");
myProgressgadget.BEGIN(workTarget);
// Call a user function
Progress_work();
myProgressgadget.PROGRESSTO(workTarget);
myInfo.SetText("Completed");
myProgressgadget.SHOWTEXT("Completed");
myProgressgadget.END();
}
// JavaScript program
--------------------------------------------------------
// --- create a new window, as usual ---
myWindow = new r3Window(
R3WGA_Parent, _r3gui,
R3WGA_Left, 200,
R3WGA_Top, 100,
R3WA_Title, "Test Progress 003",
R3WA_ReportCloseWindow, true,
R3WA_ReportNewSize, true,
R3WA_Flags, R3WASF_SIZE + R3WASF_DRAGBAR + R3WASF_MAXIMIZE +
R3WASF_MINIMIZE + R3WASF_CLOSE);//Add _[]x button.
myButton = new r3Button(
R3WGA_Parent, myWindow,
R3GA_Text, "Start",
R3GA_ToolTip, "start button",
R3RA_Hook, ButtonExecute);
myInfo = new r3Text(
R3WGA_Parent, myWindow,
R3GA_Text, "Info",
R3GA_ToolTip, "info gadget",
R3GTA_Text, "", // current value
R3GTA_Border, true);
var layer = GetJS ("CurrentProject.Geometrics");
var myProgressgadget = layer.GetProgressIndicator();
/*
myProgressgadget = new r3Progressgadget(
R3WGA_Parent, myWindow,
R3GA_Text, "Progress",
R3PGA_Horizontal, true,//layaut to horizontal.
R3PGA_NoCancelButton, false);//Display a cancel button.
*/
// --- Design layout for the GUI ----
myPacker = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
myPacker.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, myButton);
myPacker.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, myInfo);
// myPacker.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, myProgressgadget);
myWindow.SetGmanager(myPacker);
//Display indicator in info window
myButton.myInfo = myInfo;
// --- compute native size, show ---
myWindow.FIT(R3WFP_BESTFIT);
myWindow.REALIZE();
I tried to apply a similar hack to the file
"scripts/js/real/gagdet/r3progd.js" as the SDK indicates the same multiple
inheritance for this class. Unfortunately that ended up in undefined
functions. So I could not make your original example work. I.e. with a
progress indicator gadget in a separate window.
Best regards,
fre_ber
On 15 March 2014 05:25, WindowsLiveMail <[email protected]> wrote:
> Hello fre_ber.
> I wrote the following scripts.
> However, I cannot yet display a progress bar and time.
> Best regards,
> K-UDA
>
>
> // Includes ------------------------------------------------------------
> ------
> include("oops/r3window.js");
> include("oops/r3packer.js");
> include("oops/r3button.js");
> include("oops/r3text.js");
>
> include("real/gadget/r3progd.js");
> include("real/code/r3progm.js");
>
>
> // Variable declarations ------------------------------
> -----------------------
> myWindow = new Object;
> myPacker = new Object;
> myButton = new Object;
> myInfo = new Object;
> myProgressgadget = new Object;
>
>
> // Function definitions ------------------------------
> ------------------------
> function Progress_work()
> {
> for(i = 0; i < 20000; i++)
> {
> myInfo.SetText("work =" + i);
> }
> }
>
>
> // Handler for button to execute scriput.
> function ButtonExecute()
> {
> myInfo.SetText("Start");
> // Call a user function
> Progress_work();
>
> myInfo.SetText("Completed");
> }
>
>
> // JavaScript program ------------------------------
> --------------------------
> {
> // --- create a new window, as usual ---
> myWindow = new r3Window(
> R3WGA_Parent, _r3gui,
> R3WGA_Left, 200,
> R3WGA_Top, 100,
> R3WA_Title, "Test Progress 003",
> R3WA_ReportCloseWindow, true,
> R3WA_ReportNewSize, true,
> R3WA_Flags, R3WASF_SIZE + R3WASF_DRAGBAR + R3WASF_MAXIMIZE +
> R3WASF_MINIMIZE + R3WASF_CLOSE);//Add _[]x button.
>
> myButton = new r3Button(
> R3WGA_Parent, myWindow,
> R3GA_Text, "Start",
> R3GA_ToolTip, "start button",
> R3RA_Hook, ButtonExecute);
>
> myInfo = new r3Text(
> R3WGA_Parent, myWindow,
> R3GA_Text, "Info",
> R3GA_ToolTip, "info gadget",
> R3GTA_Text, "", // current value
> R3GTA_Border, true);
>
> myProgressgadget = new r3Progressgadget(
> R3WGA_Parent, myWindow,
> R3GA_Text, "Progress",
> R3PGA_Horizontal, true,//layaut to horizontal.
> R3PGA_NoCancelButton, false);//Display a cancel button.
>
>
> // --- Design layout for the GUI ----
> myPacker = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL);
> myPacker.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, myButton);
> myPacker.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, myInfo);
> myPacker.ADD(R3PAPF_FILLX, R3PAAF_ALIGN, myProgressgadget);
> myWindow.SetGmanager(myPacker);
>
> //Display indicator in info window
> myButton.myInfo = myInfo;
>
> // --- compute native size, show ---
> myWindow.FIT(R3WFP_BESTFIT);
> myWindow.REALIZE();
>
> }
>
>
>
> _______________________________________________
> User-list mailing list
> [email protected]
> http://realsoft.com/mailman/listinfo/user-list_realsoft.com
>
_______________________________________________
User-list mailing list
[email protected]
http://realsoft.com/mailman/listinfo/user-list_realsoft.com