|
Post by Rod on Apr 17, 2021 3:54:51 GMT -5
Some folks don't like the classic menu system Windows offers. This demo shows how Tab Strips might jazz up your application. Tab Strip Demo
|
|
|
Post by Rod on Apr 27, 2021 2:51:54 GMT -5
This is a small change to align the sub tabs with their main tabs. The tabs exist in a small graphicbox at the top of the window. What the lower portion does is up to you. I should make some bmpbuttons that compliment the tabs.
nomainwin
WindowWidth = 1100 WindowHeight = 660 UpperLeftX= int((DisplayWidth-WindowWidth)/2) UpperLeftY= int((DisplayHeight-WindowHeight)/2) graphicbox #1.gb, 0, 0, 1100, 48 Stylebits #1.gb, 0, _WS_BORDER, 0, 0 open "Tab Strip" for window as #1 #1 "trapclose [quit]"
hw=hwnd(#1.gb) CallDll #user32, "GetDC",_ hw as ulong,_ hdc as ulong CallDll #gdi32, "SetBkMode",_ hdc as ulong,_ _TRANSPARENT as long,_ result as long
#1 "font ms_sans_serif 10" #1.gb "font ms_sans_serif 10" #1.gb "down ; fill white"
'create tab strip content dim m$(10)'main dim s$(10)'sub dim mc$(10)'main status color dim sc$(10,10)'sub status color 'define main tab strip text m$(0)="File,Client,Site,Extent,Observations,Circuits,Inspection,Finish,Sign Off" 'define sub tab strip text s$(0)="Open,Rename" s$(1)="Name,Company,Product" s$(5)="Diagrams,Specs" s$(6)="Result,Notes" s$(7)="Date,Plan,Timing" 'define random tab color to main tabs for x=0 to 9 mc$(x)=word$("b c m g y r",int(rnd(0)*6)+1) next 'make all sub tabs default color for x=0 to 9 for y=0 to 9 sc$(x,y)="d" 'default next next
'load the colors required 'you may not need them all loadbmp "w","wht.bmp" loadbmp "d","but.bmp" 'default buttonface loadbmp "b","blu.bmp" loadbmp "c","cya.bmp" loadbmp "m","mag.bmp" loadbmp "g","gre.bmp" loadbmp "y","yel.bmp" loadbmp "r","red.bmp"
'set starting selection currenttab=0 oldtab$=mc$(0) mc$(0)="w" currentsub=0 oldsub$=sc$(0,0) sc$(0,0)="w" gosub [drawmenu] #1.gb "when leftButtonDown [GetTab]" wait
[GetTab] 'where did we click on the 100x25 grid seltab=int(MouseX/100) selsub=int(MouseY/24) if selsub=0 then 'reset current selections mc$(currenttab)=oldtab$ sc$(currenttab,currentsub)=oldsub$ oldtab$=mc$(seltab) oldsub$=sc$(seltab,0) mc$(seltab)="w" sc$(seltab,0)="w" currenttab=seltab currentsub=0 end if if selsub=1 then seltab=seltab-currenttab sc$(currenttab,currentsub)=oldsub$ oldsub$=sc$(currenttab,seltab) sc$(currenttab,seltab)="w" currentsub=seltab end if gosub [drawmenu] wait
[drawmenu] 'wipe out the last drawing #1.gb "delsegment bak ; fill buttonface"
'now draw each main tab in turn for m=0 to 10 if word$(m$(0),m+1,",")<>"" then 'get the text w$=left$(word$(m$(0),m+1,","),11) 'draw the color tab #1.gb "drawbmp ";mc$(m);" ";m*100;" 0" 'centre and place the text l=(8-len(w$)/2)*7 #1.gb "color black ; place ";m*100+l;" 16 ;\";w$ 'check if sub tabs need drawn if m=currenttab and s$(m)<>"" then for s=0 to 9 if word$(s$(m),s+1,",")<>"" then 'get the text w$=left$(word$(s$(m),s+1,","),11) 'draw the color tab #1.gb "drawbmp ";sc$(m,s);" ";(s+m)*100;" 21" 'centre and place the text l=(8-len(w$)/2)*7 #1.gb "color black ; place ";(s+m)*100+l;" 37 ;\";w$ end if next end if end if next #1.gb "flush bak" return
[quit] Close #1 END
|
|