[Closed] create new window dialog with its UI elements
I have my main script
now, how to create a window
on btn1 pressed do 
 (
   -- open another window where I will have some other btns, ui controls that will use vlaues from variables inside my main script
 )
should I have 2 rollouts?
may be you have an example
Should my variables from my main script be define as local or global?
thx in advance!
fn sendMessage2=
(
	messageBox "This is try"
)
fn getTheVal thisControl thatControl=
(
	thisControl.value=thatControl.value
)
fn createAnotherDialog =
(
	rollout UIXX "Untitled" width:162 height:179
	(
		button btn1 "Button" pos:[7,11] width:141 height:25
		combobox cbx1 "ComboBox" pos:[8,43] width:141 height:5
		spinner spn2 "" pos:[12,132] width:72 height:16 range:[0,100,20]
		
		on btn1 pressed do
		(
		sendMessage2()
		)
		
		on UIXX open do
		(
			getTheVal spn2 (mainDialog.spn1)
		)
	)
)
rollout mainDialog "Untitled" width:162 height:91
(
	button btn2 "Button" pos:[8,14] width:138 height:25
	spinner spn1 "" pos:[12,46] width:92 height:16 range:[0,100,5]
	
	
	on btn2 pressed do
	(
		mainRoll= createAnotherDialog()
		createDialog mainRoll ---you can set another pos, another width to this
		--another methods is using parent and children ...find DenisT post about parent children rollout
	)
)
createDialog mainDialog
here is another method from denisT
it’s workiiiiiiiiiing!
But how to make it on top of all max windows, – not able to select others except when you close it by pressing on ok, apply or close?
Something like this
fn sendMessage2=
(
	messageBox "This is try"
)
fn getTheVal thisControl thatControl=
(
	thisControl.value=thatControl.value
)
fn createAnotherDialog parentRoll w: h: =
(
	rollout UIXX "Untitled"
	(
		button btn1 "Button" pos:[7,11] width:141 height:25
		combobox cbx1 "ComboBox" pos:[8,43] width:141 height:5
		on btn1 pressed do (sendMessage2())
		on UIXX open do
		(
			--getTheVal spn2 (mainDialog.spn1)
		)
	)
	local pos = GetDialogPos parentRoll, rollCaption = 40 -- depends on Windows Theme (look of WIndow dialog)
	createDialog UIXX w h (pos.x) (pos.y-h-rollCaption) style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)
rollout mainDialog "Untitled" width:162 height:91
(
	button btn2 "Button" pos:[8,14] width:138 height:25
	spinner spn1 "" pos:[12,46] width:92 height:16 range:[0,100,5]
	on btn2 pressed do
	(
		mainRoll = createAnotherDialog mainDialog w:162 h:179
	)
)
createDialog mainDialog
                try(destroydialog parent) catch()
rollout parent "Parent Dialog" width:200
(
	rollout child "Child Dialog" width:200 
	(
		button close_child "Close Child Dialog" width:180
		on close_child pressed do destroydialog child
	)
	
	button open_child "Open Child Dialog" width:180
	on open_child pressed do createdialog child pos:(getdialogpos parent + [100,40]) parent:(windows.getchildhwnd 0 parent.title)[1] modal:on 
)
createdialog parent
                      I love this site! So many friendly people here! Thx a lot! You’re all great here! Thank you so much! It’s really fantastic to see your answers!
Friends, sorry that I give you so many questions, but please, I don’t even have a clue how to implement this:
I have a loop in which every time I open a window(not all of them at once) where I have 2 buttons (apply, ok) and close (top corner)! I need to stop the loop while the window is opened. Once I closed it from any of these buttons, it gets to the next iteration in loop, which means it will open a window for the next item from files:
 for i in files do 
 	 createdialog child pos:(getdialogpos parent + [100,40]) parent:(windows.getchildhwnd 0 parent.title)[1] modal:on 
???
it should look the same, with the same ui elements!
Thx for you help, Denis! Srry for taking your precious time!
you can use the same rollout:
try(destroydialog FileProcessor) catch()
rollout FileProcessor "File Processor" width:306
(
	local directory = if directory != undefined do directory
	local files = #()
	local index = 0
	
	edittext file_tx readonly:on width:276
	
	button next_bt "Next" width:90 across:3
	button prev_bt "Previous" width:90
	button process_bt "Process" width:90
	
	fn showfile = if files.count > 0 do
	(
		file_tx.text = if files[index] != undefined then (filenamefrompath files[index]) else ""
	)
	on next_bt pressed do 
	(
		index = amin files.count (index+1)
		showfile()
	)
	on prev_bt pressed do 
	(
		index = amax 1 (index-1)
		showfile()
	)
	on process_bt pressed do if files.count > 0 do
	(
		format "%
" files[index]
	)
	on FileProcessor open do
	(
		files = getfiles (directory + @"\*.*")
		format ">> % %
" directory files.count
		index = 1
		showfile()
	)
)
FileProcessor.directory = (getdir #maxroot)
createdialog FileProcessor modal:on
                I have my main rollout! In cicle it should open a new rollout!
fn CollectDialogfn scenefile folderfile =
    (
    	rollout CollectDialog "Collect" width:421 height:200
    	(
    		dotNetControl leftimg "System.Windows.Forms.Label" pos:[7,7] width:200 height:155
    		dotNetControl rightimg "System.Windows.Forms.Label" pos:[214,7] width:200 height:155
    		button btn1 "Button" pos:[7,170] width:141 height:25
    		on btn1 pressed do
    		(
    			print "col1"
    		)
    		
    		on CollectDialog open do
    		(
    			leftimg.BackgroundImage = dotnetObject "System.Drawing.Bitmap" folderfile
    			rightimg.BackgroundImage = dotnetObject "System.Drawing.Bitmap" scenefile
    		)
   		on CollectDialog close do
   		  -- continue somehow the cicle
    	)
    )	
    
    ...
   for i in files do 
   (
   	   duplicateimageRoll= CollectDialogfn scenetexture foldertexture
   	   createDialog duplicateimageRoll
 	 -- stop somehow the cicle
   )