here is my meager atempt at a flex grid as best i know how. hold the laugter to a minimum please 8O .
Code: Select all
Global listiconnumber
;- Window Constants
;
Enumeration
#Window_0
#Window_1
EndEnumeration
;- Gadget Constants
Enumeration
#Button_0
#Button_1
#Combo_0
#Combo_1
#Text_0
#Text_1
#String_0
#Text_3
#Editor_0
#Text_5
#ScrollArea_1
EndEnumeration
Procedure Flexgridgadget(scrollareanumber,flexgridx,flexgridy,flexgridwidth,flexgridheight,scrollwidth,scrollheight)
ScrollAreaGadget(scrollareanumber, flexgridx, flexgridy, flexgridwidth, flexgridheight, scrollwidth, scrollheight, 10)
scrollareanumber=listiconnumber
ListIconGadget(listiconnumber+1, 40, 30, 110, 700, "Sunday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
ListIconGadget(listiconnumber+2, 150, 30, 110, 700, "Monday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
ListIconGadget(listiconnumber+3, 260, 30, 110, 700, "Tuesday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
ListIconGadget(listiconnumber+4, 370, 30, 110, 700, "Wednesday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
ListIconGadget(listiconnumber+5, 480, 30, 110, 700, "Thursday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
ListIconGadget(listiconnumber+6, 590, 30, 110, 700, "Friday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
ListIconGadget(listiconnumber+7, 700, 30, 110, 700, "Saturday", 105, #PB_ListIcon_MultiSelect | #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
;add text boxes EVERY OTHER ITEM that mark the hours
starttimehour=5
textgadgetnumber=scrollareanumber+7
y=25 ;start at height=25
For a=scrollareanumber+7 To scrollareanumber+30
y=y+28 ;this value works best to line up boxes with listicon rows
textgadgetnumber=textgadgetnumber+1 ;add one to the previous gadget number
starttimehour=starttimehour+1 ;add one to the previous hour
If starttimehour=24 ;when we get to midnight, we start all over
starttimehour=starttimehour-24
TextGadget(textgadgetnumber,0,y,40,11,Str(starttimehour)+":00")
Else
TextGadget(textgadgetnumber,0,y,40,11,Str(starttimehour)+":00")
EndIf
Next
CloseGadgetList()
For a= listiconnumber+1 To listiconnumber+7
; LockColumnSize(a, #PB_LockAll) ;dont want to get crazy with weird column widths
Next
For a= listiconnumber+1 To listiconnumber+7 ;now we add empty spaces to the listicons
For b=0 To 47
AddGadgetItem(a,-1,"")
Next
Next
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 108, 40, 830, 609, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
CreateGadgetList(WindowID(0))
Flexgridgadget(#ScrollArea_1,0, 10, 830, 590, 850, 750)
EndIf
EndProcedure
Procedure Open_Window_1() ;this is the information window
If OpenWindow(#Window_1, 237, 162, 458, 293 , "Enter Information", #PB_Window_SizeGadget | #PB_Window_TitleBar)
If CreateGadgetList(WindowID(1))
ButtonGadget(#Button_0, 110, 250, 90, 30, "Enter")
ButtonGadget(#Button_1, 240, 250, 90, 30, "Cancel")
ComboBoxGadget(#Combo_0, 170, 20, 100, 30)
ComboBoxGadget(#Combo_1, 170, 60, 100, 30)
TextGadget(#Text_0, 70, 20, 70, 20, "Start:", #PB_Text_Center)
TextGadget(#Text_1, 70, 60, 70, 20, "Stop:", #PB_Text_Center)
StringGadget(#String_0, 110, 100, 310, 20, "")
TextGadget(#Text_3, 40, 100, 70, 20, "Event:", #PB_Text_Center)
EditorGadget(#Editor_0, 110, 130, 310, 110)
TextGadget(#Text_5, 40, 170, 70, 20, "Notes:", #PB_Text_Center)
hour=5 ;here we add all the times to the comboboxes
For a=0 To 23
hour=hour+1
AddGadgetItem(#Combo_0,-1,Str(hour)+":00")
AddGadgetItem(#Combo_0,-1,Str(hour)+":30")
Next
hour=5 ;here we add all the times to the comboboxes
For a=0 To 23
hour=hour+1
AddGadgetItem(#Combo_1,-1,Str(hour)+":00")
AddGadgetItem(#Combo_1,-1,Str(hour)+":30")
CloseGadgetList()
Next
EndIf
EndIf
EndProcedure
;-Main Program
Open_Window_0() ;open our window
;-Event Loop
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
GadgetID = EventGadget()
If GadgetID>=listiconnumber+1 And GadgetID<=listiconnumber+7
If EventType()=#PB_EventType_LeftDoubleClick
Open_Window_1()
EnableWindow_(WindowID(#Window_0),#False) ;user double clicks, and presto--info window pops up
EndIf
ElseIf GadgetID=#Button_0
EnableWindow_(WindowID(#Window_0),#True)
HideWindow(#Window_1,1)
ElseIf GadgetID=#Button_1
EnableWindow_(WindowID(#Window_0),#True)
HideWindow(#Window_1,1)
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
End
have fun:!!!!!!!
