News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

OnGetNetPage vs OnLeave in New Project wizard

Started by jimbo, November 19, 2018, 05:34:55 PM

Previous topic - Next topic

jimbo

Encountering an oddness, which I suspect is down to the order in which OnGetNetPage and OnLeave are executed.

I want to specifiy the next page in a wizard according to what is in the current page, but I cannot determine that until the OnLeave function is called, where I analyse the content of the page and set up somes variable accordingly. But it appears that OnGetNext is called before OnLeave (could be wrong, in which case something else is happening), so my tests to see what the next page should be fail as the variable are not yet set up.

Ideas?

In other news, having problems with the squirrel array.find function not working, giving a bad index error. Is that function supported in CB?

Jimbo

BlueHazzard


In other news, having problems with the squirrel array.find function not working, giving a bad index error. Is that function supported in CB?

Example code?
Are you using standard squirrel arrays or some wxWidgets binding?

jimbo

Quote from: BlueHazzard on November 19, 2018, 10:30:16 PM

In other news, having problems with the squirrel array.find function not working, giving a bad index error. Is that function supported in CB?

Example code?
Are you using standard squirrel arrays or some wxWidgets binding?

Standard squirrel array, here some C&P from the wizard, not the actual code, and not tried to see if it works, but exactly same syntax as using in actual wizard.


selectedLibraries<-array(0);

function fred()
{

  selectedLibraries.append(1);
  selectedLibraries.append(3);
  selectedLibraries.append(5);

  local idx =  selectedLibraries.find(5);    <<<<<<<< Gives a squirrel index [find] not found sort of error
}

BlueHazzard

sadly we are using squirrel 2.2.5 and there the find methode does not exists...


@obfuscate: what about updating squirrel, without going to sqrat? Squirrel is now at 3.1 with tons of fixes and additions. 2.2 is 8 years old...

jimbo

Quote from: BlueHazzard on November 20, 2018, 12:27:31 PM
sadly we are using squirrel 2.2.5 and there the find methode does not exists...


@obfuscate: what about updating squirrel, without going to sqrat? Squirrel is now at 3.1 with tons of fixes and additions. 2.2 is 8 years old...

Ah, that is what I was starting to suspect. It's not a problem, we have for loops...


jimbo

Quote from: BlueHazzard on November 20, 2018, 12:27:31 PM
sadly we are using squirrel 2.2.5 and there the find methode does not exists...


@obfuscate: what about updating squirrel, without going to sqrat? Squirrel is now at 3.1 with tons of fixes and additions. 2.2 is 8 years old...

I've also found that the string.slice funcion appears to be missing (same error) but that should be in Squirrel 2.2 which is odd.

local s = _T("abcdefghijklmnop");
local s2 = s.slice(0,5);   <<<<<<<<< AN ERROR HAS OCCURED [the index 'slice' does not exist]

oBFusCATed

@jimbo: s is not a string type, it is wxString. Search the wiki for the function reference provided by C::B in squirrel scripts.

@bluehazzard: I'm fine if you can make 3.x work with SqPlus, but I think the two were incompatible. I could be wrong of course.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

jimbo

Quote from: oBFusCATed on November 20, 2018, 07:12:15 PM
@jimbo: s is not a string type, it is wxString. Search the wiki for the function reference provided by C::B in squirrel scripts.

AhHa! Knew I was doing something stupid. Thanks.

BlueHazzard

Just a little update (and also a permanent note for me, because i do not want again debug a few hours for this)
Porting the scripting engine to 3.0 is not easy possible with sqplus, because squirrel 3.0 releases variables after poping from the internal stack.
This is basically not the problem, but sqplus always returns a reference as return value of squirrel functions. After the scripting function call sqplus stores the reference to the return value and cleans the stack. This will destroy the variable returned by the squirrel function, if this variable was only existent in this function. So the from sqplus stored reference to the return value is now invalid and sqplus returns an invalid reference to the c++ user code. This is very unfortunate. I tried to implement a function that returns a copy of the object , but then all non copyable script bindings (like the ProjectManager) can not be used anymore.
Maybe i split them out...
It is not trivial, and you have to be very carefully with the type of return value you use.
I do not remember how sqrat solves this problem...

BlueHazzard


oBFusCATed

As a start.
Can you make a patch where you carefully fix the problem with "base is now a keyword" and commit it? You're doing it for at least a second time, so I guess it doesn't hurt if we fix it in current version of squirrel.

But be careful, I don't think the current commit is correct. And do just a single thing in this commit.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

BlueHazzard

Quote from: oBFusCATed on November 22, 2018, 08:31:43 AM
But be careful, I don't think the current commit is correct. And do just a single thing in this commit.
Doh.... i was to fistrated yesterday from debugging the issue and made a quick search and replace... This was a BAD idea. Thank you for pointing it out...

BlueHazzard

Ok, this should be ok for the "base" keyword in the default scripts.
Can someone check this?

oBFusCATed

I don't like using just different case.
It is pretty easy to make mistakes.
Isn't target more appropriate in most cases?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

BlueHazzard