
Function to Use Relative Window Sizes

jjweimer
// structure to store screen parameters // values are RELATIVE SIZES // POINTS: used for /W=() in tables and graphs // PIXELS: used for /W=() in panels STRUCTURE ScreenSizeParameters variable scrwpxl variable scrhpxl variable scrwpnt variable scrhpnt ENDSTRUCTURE // initialize the screen sizes Static Function InitScreenParameters(ScrP) STRUCT ScreenSizeParameters &ScrP // get screen pixel sizes if (cmpstr(IgorInfo(2),"Macintosh")==0) // MacOS string IgorStuff="" variable scr0,scr1,scr2 IgorStuff=IgorInfo(0) scr0 = strsearch(IgorStuff,"RECT",0) scr1 = strsearch(IgorStuff,",",scr0+9) scr2 = strlen(IgorStuff)-2 ScrP.scrwpxl = str2num(IgorStuff[scr0+9,scr1-1])/100 ScrP.scrhpxl = str2num(IgorStuff[scr1+1,scr2])/100 else // WinXX (must maximize the frame) MoveWindow/F 2, 2, 2, 2 GetWindow kwFrameInner wsizeDC ScrP.scrwpxl = (v_right-v_left)/100 ScrP.scrhpxl = (v_bottom-v_top)/100 endif // set screen point sizes ScrP.scrwpnt = ScrP.scrwpxl*72/ScreenResolution ScrP.scrhpnt = ScrP.scrhpxl*72/ScreenResolution return 0 end // EXAMPLE USEAGE // Show Examples displays a graph and panel at 60%x40% of screen Function ShowExamples() // define the screen parameter structure STRUCT ScreenSizeParameters ScrP // initialize it InitScreenParameters(ScrP) // show a graph window at 60% x 40% of screen display/W=(0,0,60*ScrP.scrwpnt,40*ScrP.scrhpnt) as "60 x 40 Graph" // show a table window at 60% x 40% of screen edit/W=(0,0,60*ScrP.scrwpnt,40*ScrP.scrhpnt) as "60 x 40 Table" // show a panel at 60% x 40% of screen NewPanel/W=(0,0,60*ScrP.scrwpxl,40*ScrP.scrhpxl) as "60 x 40 Panel" return 0 end

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More