Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 3-Oct-2014 17:02:08

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

dynamically setting flags on a window or any other scol object?

colleagues:

for the text input/output plugit I've been working on, I'd like the editor to be able to set window flags. in the api online all the flags are of the form I.

How would I set some flags and not others?

Are the flags set as a list of intergers? something like:

1::0::1::1::0::1::nil

in the order that they are listed on the api (http://www.scolring.org/files/doc_html/_crwindow.html)  for example:

WN_MINIMIZE	window is created as minimized
WN_HIDDEN	window is created as hidden
WN_MENU	add a menu bar to the window
WN_MINBOX	display a minimize icon on the menu bar
WN_SIZEBOX	window has a resizable border
WN_NOBORDER	window has no border
WN_NOCAPTION	window has no title
WN_CHILDINSIDE	window is a child window, without title and border
WN_DOWN	display a 3d border
WN_DRAGDROP	allow drag and drop inside the window
WN_MAX	display a maximize icon on the menu bar
WN_TOPMOST	always on top
WN_NOSCOL	removes the "(Scol)" word in windows titles.
WN_CHILD	similar at WN_CHILDINSIDE but allows others options
WN_CHILDMENU	
allow the system menu to the child window

so would this work?
set win = _CRwindow _channel nil 0 0 300 200 1 "Test Child"
instead of
set win = _CRwindow _channel nil 0 0 300 200 WN_NORMAL "Test Child"

Offline

#2 3-Oct-2014 18:09:21

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: dynamically setting flags on a window or any other scol object?

Don't use a "numeric" value directly.

If you want to combine any flags (it is the same thing for all Scol functions with flags) :

set win = _CRwindow _channel nil 0 0 300 200 WN_MINBOX|WN_NOBORDER|WN_TOPMOST "Test Child";

Separate each flag with an 'binary or' : |

Offline

#3 3-Oct-2014 20:39:18

Bob Le Gob
Scol language & Scol applications developer
Registered: 9-Apr-2009
Posts: 26

Re: dynamically setting flags on a window or any other scol object?

It is not recommended to use integers instead of the "named" flags. This would 1) make your code less comprehensible (even for you) and 2) let you vulnerable to changes in the VM code.

Bob

Offline

#4 8-Oct-2014 15:28:01

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: dynamically setting flags on a window or any other scol object?

[solved]

I see a way of setting flags in cmainwindow.pkg so disregard my question colleagues:

///scol code
let WN_MENU|WN_SIZEBOX -> style in

    (

      if (border) then nil else

        set style = style | WN_NOBORDER;

      

      if (caption) then nil else

        set style = style | WN_NOCAPTION;

      

      if (resize) then nil else

        set style = style & ~(WN_SIZEBOX);

      

      if (!catchClose) then nil else

      _CBwinClose mainWindow.EDW_win @cbWinClose inst;
      _SETwindowStyle mainWindow.EDW_win style;

      

    //more code

Offline

#5 10-Oct-2014 16:25:27

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: dynamically setting flags on a window or any other scol object?

I don't understand what you want to do but there is a very strange thing in this code :

hebdemnobad wrote:
if (!catchClose) then nil else

      _CBwinClose mainWindow.EDW_win @cbWinClose inst;
      _SETwindowStyle mainWindow.EDW_win style;

Your else block is only :

_CBwinClose mainWindow.EDW_win @cbWinClose inst;

Maybe it is right about your idea ... smile

Offline

#6 10-Oct-2014 16:30:51

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: dynamically setting flags on a window or any other scol object?

iri wrote:

I don't understand what you want to do but there is a very strange thing in this code :

hebdemnobad wrote:
if (!catchClose) then nil else

      _CBwinClose mainWindow.EDW_win @cbWinClose inst;
      _SETwindowStyle mainWindow.EDW_win style;

Your else block is only :

_CBwinClose mainWindow.EDW_win @cbWinClose inst;

Maybe it is right about your idea ... smile


thx Iri, Arkeon helped me out in the other thread you just commented on as for the callback issue. I will probably separate the modifications from the mainwindow code as I ended up not using any of it save for learning how to invoke functions of the root window for the player.

I just posted that code to show how the flags can be changed dynamically.

Last edited by hebdemnobad (10-Oct-2014 16:36:02)

Offline

Board footer

Powered by FluxBB