Panels & Co.

tutor
Posts: 14
Joined: 2008-06-17
Location: Germany

Hi,

I am working on a panel where I'm using tabs. Is there a way to use the /FLT=1 in the NewPanel command. I would like to have the Tab panel and the floating option in the same time.

Thanks


Posts: 566
Joined: 2007-06-29
Location: United States

Maybe I've misunderstood something- tabs are a type of control. You can put a tab control (or more than one!) into any control panel, including floating panels.

Floating panels behave a little bit strangely with regard to editing, so you might want to develop your panel as a non-floating panel, then convert to floating when the panel is stable.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com


tutor
Posts: 14
Joined: 2008-06-17
Location: Germany

Hello,

Thank you for the reply. So, when I do :

NewPanel /K=1 /W=(500,500,940,800) as " Spec Import Control " ---> all compiles OK!

when I use:

NewPanel /K=1 /FLT=1 /W=(500,500,940,800) as " Spec Import Control " --> I get all the time an error, each time when I try to change in between tabs. The change is anyway done but the error is there. Error: "There are no graph or panels or the specified window does not exist ".

If you are saying it should work in the same way for floating or non-floating windows, I'll try more to get the error.

Best, T


JimProuty's picture
Posts: 180
Joined: 2007-07-19
Location: United States

NewPanel /K=1 /W=(500,500,940,800) as " Spec Import Control "

By the way, that command doesn't explictly set a panel *name*, only a *title*.

Here's a quick demo of floating panels and tabs:

#pragma rtGlobals=1		// Use modern global access method.
 
Macro CreateTabbedFloatingPanel()
 
	DoWindow SpecImportPanel
	if( V_Flag )
		KillWindow SpecImportPanel
	endif
 
	Variable flt=1	// 0 for development
	Variable initialTabNum= 0
 
	NewPanel/N=SpecImportPanel/K=1 /FLT=(flt) /W=(500,500,940,800) as " Spec Import Control "
	TabControl tab0,pos={15,12},size={406,270},proc=SpecTabProc,tabLabel(0)="Tab 0"
	TabControl tab0,tabLabel(1)="Tab 1",value= initialTabNum
	Button button0inTab0,pos={101,71},size={115,21},proc=Tab0ButtonProc,title="This button is in Tab 0"
	Button button0inTab1,pos={102,71},size={115,21},proc=Tab1ButtonProc,title="This button is in Tab 1"
	CheckBox checkboxInTab0,pos={105,107},size={92,14},title="Checkbox in Tab 0"
	CheckBox checkboxInTab0,value= 0
 
	if( flt )
		SetActiveSubwindow _endfloat_
	endif
	SpecTabProc("",initialTabNum)
End
 
StrConstant ksControlsInTab0= "button0inTab0;checkboxInTab0;"	
StrConstant ksControlsInTab1= "button0inTab1;"	
 
Function SpecTabProc(ctrlName,tabNum) : TabControl
	String ctrlName
	Variable tabNum
 
	Variable disabled = (tabNum == 0) ? 0 : 1
	ModifyControlList ksControlsInTab0, win=SpecImportPanel, disable=disabled
 
	disabled = (tabNum == 1) ? 0 : 1
	ModifyControlList ksControlsInTab1, win=SpecImportPanel, disable=disabled
 
	return 0
End
 
Function Tab0ButtonProc(ctrlName) : ButtonControl
	String ctrlName
 
	DoAlert 0, "This button is in Tab 0"
 
End
 
Function Tab1ButtonProc(ctrlName) : ButtonControl
	String ctrlName
 
	DoAlert 0, "This button is in Tab 1"
 
End

--Jim Prouty
Software Engineer, WaveMetrics, Inc.


[ last edited February 10, 2010 - 19:30 ]
tutor
Posts: 14
Joined: 2008-06-17
Location: Germany

That was clear,

Thank you so much!

Regards,
T


Back to top