Notifications
Clear all

[Closed] new test windowdialog does not open

I do not know too much english
my problem, new test windowdialog does not open when I press the button asd

global test
 
 
  Rollout test "cap1"
  (
    Spinner s1 "cap2"
  )
--   createdialog test
 

test.isDisplayed 
 
rollout test1 ""
(
	subrollout asdf width:140 height:100
	button asd""
 
	on asd pressed do    ------does not work
	(createdialog test)
 
 
)
createdialog test1
AddSubRollout test1.asdf test

Would you help with code sample

8 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

max doesn’t allow to have more than one instance of the same rollout. You are trying to create dialog for already opened rollout. If you remove the sub-rollout you will be able to create the dialog:


 global test
 rollout test "cap1"
 (
 	spinner s1 "cap2"
 )
 rollout test1 ""
 (
 	subrollout asdf width:140 height:100
 	button asd""
  
 	on asd pressed do   
 	(
 		removeSubRollout test1.asdf test
 		createdialog test
 	)
 )
 createdialog test1
 AddSubRollout test1.asdf test
 
 lo1

I can only confirm that it doesn’t work for me either… I don’t see anything you are doing wrong, I can only guess that rollouts that are inside subrollout controls can not be created independently as well.

is it not a scope issue?

rollout test1 ""
(
	Rollout test "cap1"
  (
    Spinner s1 "cap2"
  )

	subrollout asdf width:140 height:100
	button asd"" 
  
	on asd pressed do createdialog test
)
createdialog test1
AddSubRollout test1.asdf test
 lo1

@Pete: I think the OP’s intent was to both have the dialog appear in the subrollout and be created independently as a floater using createDialog, or at least that’s what I think… I read his post on the area but responded here. The code is different there.

1 Reply
(@lonerobot)
Joined: 11 months ago

Posts: 0

ok guys, my bad. That makes sense. you can’t have two instances of the same rollout. now why do this exactly?

LoneRobot: not really, in your example you’d have to have

addSubRollout test1.asdf test1.test

if there’s no global test rollout already defined.

What’s the use of having two instances of the same rollout floating around anyway? One can detach it to a floating dialog by replacing the button event handler with

	on asd pressed do
 	(
 		removeSubRollout asdf test
 		createdialog test
 	)

but I’m not sure if that is what you really want to do…

I can’t think of no use for the original method either, but I kind of like the idea of detaching the subrollouts (but keeping the values). Could be fun and it could even be extended to work as a palette for some tools because the detached dialogs would stay there even after closing it. Something like this, but with .ini settings (and probably without destroying all the dialogs when run):

try (destroyDialog testParent; destroyDialog testParent.testChild1; destroyDialog testParent.testChild2; destroyDialog testParent.testChild3) catch()
rollout testParent "My Numerous Tools"
(
	subRollout testContainer width:140 height:210
	button btnDetach1 "   1   " across:3
	button btnDetach2 "   2   "
	button btnDetach3 "   3   "

	rollout testChild1 "Child1"
	(
		spinner s1 "cap2"
	)
	
	rollout testChild2 "Child2"
	(
		label lbl1 "Test 2:"
		editText etInput ""
	)
	
	rollout testChild3 "Child3"
	(
		label lbl1 "Test 3:"
		editText etInput ""
	)

	fn transferValues target container: type:#dialog =
	(

		local settings = for ctrl in target.controls collect
		(
			case classOf ctrl of
			(
				SpinnerControl: #(ctrl.name, #value, ctrl.value)
				EditTextControl: #(ctrl.name, #text, ctrl.text)
				-- etc.
				default: dontCollect
			)
		)
		
		if type == #dialog then createDialog target
		else addSubRollout container target
		
		for s in settings do
			setProperty (getProperty target s[1]) s[2] s[3] -- thanks denisT !
	)

	fn detachRollout target container =
	(
		if NOT target.inDialog then
		(
			removeSubRollout container target
			transferValues target
		)
		else
		(
			try destroyDialog target catch()
			transferValues target container:container type:#subRol
		)
	)

	on testParent open do
	(
		addSubRollout testContainer testChild1
		addSubRollout testContainer testChild2
		addSubRollout testContainer testChild3
	)

	on btnDetach1 pressed do
		detachRollout testChild1 testContainer

	on btnDetach2 pressed do
		detachRollout testChild2 testContainer

	on btnDetach3 pressed do
		detachRollout testChild3 testContainer
)
createDialog testParent

1 Reply
(@yunusbbayram)
Joined: 11 months ago

Posts: 0

great code thanks Swordslayer, LoneRobot