NewPanel problem

Hi

I have a problem to implement a new panel into a window. The problem is as follows:

1) I have a Window which includes a few tabs.
2) In one these tabs I have a button (lets call it "NewPanelButt") to open a new panel which includes ListBox, setVariable and other objects.
3) When I press the NewPanelButt, all buttons in the main windows and other tabs are being deactivated or disappeared. However some new checkbox and some of the objects from the main window will appear in the new panel, and everything get messy.
4) I should close the window and open it again to fix this mess.
5) However, everything works well inside the main window if I did NOT click on it when the new panel is still open.


Here is the command for the new panel:

NewPanel/HOST=#/EXT=2/HIDE=0/N=New_Panel_test/K=1/W=(0,0,800,280)


Is there any suggestion to fix this problem?



Posting the actual code would have been more helpful. And the Igor version.

I suspect that the code that creates the new panel includes commands to create controls.

Those commands MUST use the win= keyword when creating controls in an exterior window.

The win=Panel0#New_Panel_test keyword=value pair must be in EACH Button, TabControl, etc command (Here I'm assuming that your window's name is "Panel0", but it could be "Graph0" or whatever):

Button button0 win=Panel0#New_Panel_test, title="My Button" // identifies which window to put button0 in
Button button0 win=Panel0#New_Panel_test, disable=2 // this command must have win=, too.


--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Thank you Jim for your hints.

I'm working with Igor Pro 6.22A.

The code is very long and it is not helpful to put the whole code here, however I put here the proc function for controlling the button ("Open_New_Panel") which creates the new panel("Excitaion_Energy"):

// That function control the "Open_New_Panel" button in the host window "Experiment" to open the "Excitaion_Energy " panel
Function Elem_Info(ctrlname) : ButtonControl
string ctrlname
 
NewPanel/HOST=# /EXT=2/HIDE=0/N=Excitation_Energies/K=1/W=(0,0,800,280)
SetActiveSubwindow #
SetActiveSubwindow _endfloat_ //
ModifyPanel fixedSize=0
NVAR  row_start0= $(TS_ROOT+"ROI:row_start0")

SetVariable Exc_Max0,win=Experiment#Excitation_Energies,size={180,50}, title = "Excitation Energy (eV):",   proc=get_Exc_Enr_Max
SetVariable Exc_Max0, win=Experiment#Excitation_Energies,pos={200,10},limits={10,115626,10}, live=1, frame=1,variable =$(TS_ROOT+"ROI:Excitation_Max")
SetVariable Exc_Max0, win=Experiment#Excitation_Energies,format="%g"
SetVariable Exc_Min0,win=Experiment#Excitation_Energies,size={170,50}, title = "Low Energy Cut (eV) Min:",   proc=get_Exc_Enr_Min
SetVariable Exc_Min0, win=Experiment#Excitation_Energies,pos={20,10},limits={10,115606,1}, live=1, frame=1,variable =$(TS_ROOT+"ROI:Excitation_Min")
SetVariable Exc_Min0,win=Experiment#Excitation_Energies,help={"Enter the excitation Energy here in KeV"},  format="%g"

ListBox Sug_Elem,win=Experiment#Excitation_Energies,mode=6, font=$kLB_FONT, fsize=kLB_FONTSIZE, size={560,200}, pos={20,30}
ListBox Sug_Elem, win=Experiment#Excitation_Energies,fstyle=0,disable=0,userColumnResize= 1, editStyle=0
ListBox Sug_Elem,win=Experiment#Excitation_Energies, widths={15,20,20, 20, 20, 20, 20, 20, 20, 20, 20, 20,20,20}, hScroll = 900
ListBox Sug_Elem , win=Experiment#Excitation_Energies,  listWave=$(TS_ROOT+"ROI:ElementsTable") , proc = ROIActionProcName1
ListBox Sug_Elem,win=Experiment#Excitation_Energies,title="Suggested Elements",appearance={default}, col=0, frame=3//, row =row_start0, selRow= row_start0
//7777777777777777777777777777777777
ListBox elem_det, win=Experiment#Excitation_Energies,mode=2, font=$kLB_FONT, fsize=kLB_FONTSIZE, size={200,200}, pos={595,30}
ListBox elem_det, win=Experiment#Excitation_Energies,fstyle=0,disable=0,userColumnResize= 1, editStyle=0, proc = ROIActionProcName2
ListBox elem_det, win=Experiment#Excitation_Energies, listWave=$(TS_ROOT+"ROI:ELEMDetail"), clickEventModifiers = 1
ListBox elem_det, win=Experiment#Excitation_Energies,title="Element Details",appearance={default}, col=0, frame=3, selWave= $(TS_ROOT+"ROI:CellSel")
//DrawText 630,25,"Transition Energies"
SetVariable test_but_wid,win=Experiment#Excitation_Energies, size={140,50}, title = "peak width (eV) :",   proc=get_ROI_Width
SetVariable test_but_wid, win=Experiment#Excitation_Energies,pos={640,240},limits={10,115606,5}, live=1, frame=1,variable =$(TS_ROOT+"ROI:ROI_Width")
SetVariable test_but_wid, win=Experiment#Excitation_Energies,help={"Enter the excitation Energy here in KeV"},  format="%g", disable=2
Button btn_insert_ROI, win=Experiment#Excitation_Energies,title = "Insert ROI", pos={670,260}
Button btn_insert_ROI,win=Experiment#Excitation_Energies,size={60,15}, proc = Insert_ROI1, disable=2
//7777777777777777777777777777777777
Button btn_update, win=Experiment#Excitation_Energies,title = "Update", pos={400,10}, disable=2
Button btn_update,win=Experiment#Excitation_Energies,size={60,15}, proc = elements_update
//  element_transitions_info()
DoUpdate
// jump_to_elem()
end


I should make it clear that the buttons and etc in the new panel (Excitation_Energies) work fine. The problem is that when this new panel is still open and I click on the host window (Experiment), the buttons on the host window (Experiment) disappear or deactivate and some of them will appear in the new panel (Excitation_Energies). I think the problem is that, by pressing the "Open_New_Panel" button in the host window to open the new panel, Igor identify the new panel as the main panel and then shows the Host window (Experiment) objects in the New Panel.

Thanks
The SetActiveSubWindow etc command is probably the problem. The _endfloat_ business is needed only if NewPanel/FLT is used.

I revised your function slightly and created a framework for testing:
StrConstant TS_ROOT = "root:"
StrConstant kLB_FONT="default"
Constant kLB_FONTSIZE=0

Macro Test()
    NewDataFolder/O root:ROI
    Variable/G root:ROI:Excitation_Max,  root:ROI:Excitation_Min,  root:ROI:ROI_Width
    Variable/G  root:ROI:row_start0
    Make/O/N=(10,3)  root:ROI:CellSel
    Make/T/O/N=(10,3)  root:ROI:ELEMDetail
    DoWindow/K Experiment
    Experiment()
End

Window Experiment() : Panel
    PauseUpdate; Silent 1       // building window...
    NewPanel /W=(196,96,388,215)
    Button info,pos={79,47},size={50,20},proc=Elem_Info,title="Info"
EndMacro

// That function control the "Open_New_Panel" button in the host window "Experiment" to open the "Excitaion_Energy " panel
Function Elem_Info(ctrlname) : ButtonControl
string ctrlname
 
#if 0
NewPanel/HOST=# /EXT=2/HIDE=0/N=Excitation_Energies/K=1/W=(0,0,800,280)
SetActiveSubwindow #
SetActiveSubwindow _endfloat_ //
ModifyPanel fixedSize=0
#else
NewPanel/HOST=Experiment/EXT=2/HIDE=0/N=Excitation_Energies/K=1/W=(0,0,800,280)
//ModifyPanel/W=Experiment#Excitation_Energies fixedSize=0  // fixedSize=0 is already the default
#endif
NVAR  row_start0= $(TS_ROOT+"ROI:row_start0")
 
SetVariable Exc_Max0,win=Experiment#Excitation_Energies,size={180,50}, title = "Excitation Energy (eV):",   proc=get_Exc_Enr_Max
SetVariable Exc_Max0, win=Experiment#Excitation_Energies,pos={200,10},limits={10,115626,10}, live=1, frame=1,variable =$(TS_ROOT+"ROI:Excitation_Max")
SetVariable Exc_Max0, win=Experiment#Excitation_Energies,format="%g"
SetVariable Exc_Min0,win=Experiment#Excitation_Energies,size={170,50}, title = "Low Energy Cut (eV) Min:",   proc=get_Exc_Enr_Min
SetVariable Exc_Min0, win=Experiment#Excitation_Energies,pos={20,10},limits={10,115606,1}, live=1, frame=1,variable =$(TS_ROOT+"ROI:Excitation_Min")
SetVariable Exc_Min0,win=Experiment#Excitation_Energies,help={"Enter the excitation Energy here in KeV"},  format="%g"
 
ListBox Sug_Elem,win=Experiment#Excitation_Energies,mode=6, font=$kLB_FONT, fsize=kLB_FONTSIZE, size={560,200}, pos={20,30}
ListBox Sug_Elem, win=Experiment#Excitation_Energies,fstyle=0,disable=0,userColumnResize= 1, editStyle=0
ListBox Sug_Elem,win=Experiment#Excitation_Energies, widths={15,20,20, 20, 20, 20, 20, 20, 20, 20, 20, 20,20,20}, hScroll = 900
ListBox Sug_Elem , win=Experiment#Excitation_Energies,  listWave=$(TS_ROOT+"ROI:ElementsTable") , proc = ROIActionProcName1
ListBox Sug_Elem,win=Experiment#Excitation_Energies,title="Suggested Elements",appearance={default}, col=0, frame=3//, row =row_start0, selRow= row_start0
//7777777777777777777777777777777777
ListBox elem_det, win=Experiment#Excitation_Energies,mode=2, font=$kLB_FONT, fsize=kLB_FONTSIZE, size={200,200}, pos={595,30}
ListBox elem_det, win=Experiment#Excitation_Energies,fstyle=0,disable=0,userColumnResize= 1, editStyle=0, proc = ROIActionProcName2
ListBox elem_det, win=Experiment#Excitation_Energies, listWave=$(TS_ROOT+"ROI:ELEMDetail"), clickEventModifiers = 1
ListBox elem_det, win=Experiment#Excitation_Energies,title="Element Details",appearance={default}, col=0, frame=3, selWave= $(TS_ROOT+"ROI:CellSel")
//DrawText 630,25,"Transition Energies"
SetVariable test_but_wid,win=Experiment#Excitation_Energies, size={140,50}, title = "peak width (eV) :",   proc=get_ROI_Width
SetVariable test_but_wid, win=Experiment#Excitation_Energies,pos={640,240},limits={10,115606,5}, live=1, frame=1,variable =$(TS_ROOT+"ROI:ROI_Width")
SetVariable test_but_wid, win=Experiment#Excitation_Energies,help={"Enter the excitation Energy here in KeV"},  format="%g", disable=2
Button btn_insert_ROI, win=Experiment#Excitation_Energies,title = "Insert ROI", pos={670,260}
Button btn_insert_ROI,win=Experiment#Excitation_Energies,size={60,15}, proc = Insert_ROI1, disable=2
//7777777777777777777777777777777777
Button btn_update, win=Experiment#Excitation_Energies,title = "Update", pos={400,10}, disable=2
Button btn_update,win=Experiment#Excitation_Energies,size={60,15}, proc = elements_update
//  element_transitions_info()
DoUpdate
// jump_to_elem()
end


--Jim Prouty
Software Engineer, WaveMetrics, Inc.