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 23-Sep-2024 20:38:33

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

problems with tabs object from 2d api [solved with workaround]

hello everyone I am having problems building an app with the tabs api  (posted to : https://redmine.openspace3d.com/project … tabs.html)

the scol code is from that page on redmine:

var A = 3;;
	
fun cbTabChange (obj, u, i)=
	_fooS strcat "tab " u;
	_fooS strcat "new tab selected : " itoa i;;

fun cbSize (o, tab, w, h)=
	_DELtab tab 2;
	_APPENDtab tab strcat "number " itoa A;
	++A;
	0;;

fun main ()=
	_showconsole;
	
	let _CRwindow _channel nil 300 50 800 600 WN_NORMAL "test tabs" -> win in
	let _CRtabExpand _channel win TAB_SHOWN -> tab in
	(
	_fooS if tab == nil then "TABS NOT CREATED" else "TABS CREATED";
	
	_ADDtab tab "number 1" 0;
	_ADDtab tab "number 2" 1;
	_ADDtab tab "number 3" 2;

	_SETtabSelected tab 1;
	_SETtabPadding tab 10 20;

	_CBtabChange tab @cbTabChange "changed";

	let _CRwindowInTab _channel tab 0 WN_CHILDINSIDE -> child in
	_CRbutton _channel child 5 50 250 200 0 "BOUTON CHILD 0";
	let _CRwindowInTab _channel tab 1 WN_CHILDINSIDE -> child in
	_CRbutton _channel child 5 5 250 200 0 "BOUTON CHILD 1";
	let _CRwindowInTab _channel tab 2 WN_CHILDINSIDE -> child in
	_CRbutton _channel child 50 50 250 200 0 "BOUTON CHILD 2";
	
	_CBwinSize win @cbSize tab;	
	0
	);;

when scol runs main(), you don't see the buttons in any of the tabbed windows at first.

you have to switch from the first selected tab window to another to see the buttons in the tab windows. so if tab "Number 1" is selected when you run main, there is no button. when you switch to tab "Number 3" or "Number 2", you will see buttons in those tabs, and if you switch from either of those tabs back to "Number 1", you will see the button there.  It seems that you have to change a tab in order to start seeing buttons anywhere, whatever tab is selected first as per the code.

1. is this due to the beta nature of the api?
2. is there a workaround?
3. do i have to use the
thanks for your input!

I have posted the .scol and .pkg files here
-Dan

Last edited by hebdemnobad (6-Oct-2024 15:29:24)

Offline

#2 24-Sep-2024 09:10:09

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: problems with tabs object from 2d api [solved with workaround]

Hello,

this is a window only API, and honestly I never used it ^^

you can try this https://www.openspace3d.com/scoldoc/_paintwindow.html
_PAINTwindow win; after the last button creation.

Offline

#3 24-Sep-2024 13:11:11

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

Re: problems with tabs object from 2d api [solved with workaround]

arkeon wrote:

Hello,

this is a window only API, and honestly I never used it ^^

you can try this https://www.openspace3d.com/scoldoc/_paintwindow.html
_PAINTwindow win; after the last button creation.

Thanks ill try rhat. What does os3d use to make tab behavior and what .pkg files are required for that?

Offline

#4 24-Sep-2024 13:42:51

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: problems with tabs object from 2d api [solved with workaround]

OS3D use it's own lib written in scol

load the file g2dlib.pkg, check the os3dplayer.scol for that
https://redmine.openspace3d.com/project … tools.html

Offline

#5 24-Sep-2024 14:22:42

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

Re: problems with tabs object from 2d api [solved with workaround]

hebdemnobad wrote:
arkeon wrote:

Hello,

this is a window only API, and honestly I never used it ^^

you can try this https://www.openspace3d.com/scoldoc/_paintwindow.html
_PAINTwindow win; after the last button creation.

Thanks ill try rhat. What does os3d use to make tab behavior and what .pkg files are required for that?

i found a workaround, if you call _SETtabSelected tab 0 after you create all the ui elements, and they will appear on the first tab that is selected when you run the main function here:

fun main ()=
	_showconsole;
	
	let _CRwindow _channel nil 300 50 800 600 WN_NORMAL "test tabs" -> win in
	let _CRtabExpand _channel win TAB_SHOWN -> tab in

	(
	
	_fooS if tab == nil then "TABS NOT CREATED" else "TABS CREATED";
	
	_ADDtab tab "number 1" 0;
	_ADDtab tab "number 2" 1;
	_ADDtab tab "number 3" 2;
   //don't call _SETtabSelected BEFORE you create all ui elements, else the elements won't appear on the first selected tab
	//_SETtabSelected tab 0;
	_SETtabPadding tab 10 20;

	_CBtabChange tab @cbTabChange "changed";

	let _CRwindowInTab _channel tab 0 WN_CHILDINSIDE -> child in
	 _CRbutton _channel child 5 50 250 200 0 "BOUTON CHILD 0";
	let _CRwindowInTab _channel tab 1 WN_CHILDINSIDE -> child in
   _CRbutton _channel child 5 5 250 200 0 "BOUTON CHILD 1";
	let _CRwindowInTab _channel tab 2 WN_CHILDINSIDE -> child in
	_CRbutton _channel child 50 50 250 200 0 "BOUTON CHILD 2";
	//call SETtabSelected HERE, AFTER you create the ui elements
	_SETtabSelected tab 0;
	_CBwinSize win @cbSize tab;	
	0
	);;

Last edited by hebdemnobad (24-Sep-2024 17:41:13)

Offline

#6 24-Sep-2024 14:23:47

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

Re: problems with tabs object from 2d api [solved with workaround]

arkeon wrote:

OS3D use it's own lib written in scol

load the file g2dlib.pkg, check the os3dplayer.scol for that
https://redmine.openspace3d.com/project … tools.html

I will wait until I build the app logic with the basic ui and then look into using os3d api's to rebuild.

Offline

Board footer

Powered by FluxBB