[V4REV] Notes on example stack

Robert Brenstein rjb at robelko.com
Tue Jun 14 12:38:10 CDT 2005


>Hello Robert,
>
>Tuesday, June 14, 2005, 2:56:38 AM, you wrote:
>
>RB> It may be a good idea to open example substacks as modal windows, so
>RB> Revolution does not keep asking whether I want to save changes. For
>RB> example, the RecordLocks example does that very consistently.
>
>Ok. How it would be done - to get the modal window in Rev.?

I meant to say modeless NOT modal. I want to be able to open multiple examples.

go stack "example5" as modal
go stack "example5' as modeless

or

modal stack "example5"
modeless stack "example5"

If you need to pass data between your parent stack and any child, use 
the dialogData property. It is a global (object-less) property. For 
example,

  ...
  put recId & cr & tblName into the dialogData
  if the shiftKey is down then
    toplevel stack "displayRecord"
  else
    modal stack "displayRecord"
  end if
...

the if structure is handy for development: if I hold the shift key 
down while this runs, the substack opens as normal editable stack, so 
I can make changes.

Now, the "DisplayRecord" can have

on openStack
  put line 1 of the dialogData into recId
  put line 2 of the dialogData into tblName
  put "Select * From" && tblName && "where recid =" && recId into query
  ...


>Here is one more problem. Many examples use own substacks like property
>window. Do you know the way to get such behaviour without coding:
>All "childs" windows are closing on example-stack window "on close" event?

A substack can't have its own substacks. All substacks are parallel. 
But this has no effect on functionality. When an example opens a 
secondary window (another substack), you open it either as modal or 
as modeless window. If former, there is no need to close the parent 
as we return to it when child closes. If latter, again no need to 
close parent, because it is not really a parent -- they co-exist in 
parallel.

>
>And second question.
>
>I'm going to change all examples' scripts using some tool-stack script.
>Could you give me a point how I can access and change script in the
>stack?
>
>Let it be "on open stack" event of each stack for instance.
>

To manipulate script programmatically, the easiest is to fetch them 
into a variable

put the script of cd 1 of stack "example1" into cScript

and the do whatever you want to do. Note that you get the whole 
script, to you need to use lineOffset to find where the beginning and 
end of a given handler

put lineOffset("on openStack",cScript) into hLineBegin
put lineOffset("end openStack",cScript) into hLineEnd

so to replace this handler with a new code

put newOpenStackScript into line hLineBegin to hLineEnd of cScript

and to replace the script in the original object

set the script of cd 1 of stack "example1" to cScript

Robert


More information about the Valentina-beta mailing list