calendar drag drop
-
- Enthusiast
- Posts: 115
- Joined: Sat Sep 12, 2009 3:06 pm
calendar drag drop
Is there a way to drag drop schedule events in calendar module of a calendar perhaps? examples?
Re: calendar drag drop
Do you mean like in ical-format?
Not quiet sure about which module you are talking, but in general it would work something like that:
Not quiet sure about which module you are talking, but in general it would work something like that:
Code: Select all
EnableExplicit
Enumeration Gagets
#GAD_CAL
#GAD_EDIT
EndEnumeration
Enumeration Windows
#WIN_MAIN
EndEnumeration
Procedure onDrop()
Select EventDropType()
Case #PB_Drop_Files
Protected.s file_list.s = EventDropFiles()
Protected.s first_file.s = StringField(file_list,1, Chr(10))
If FileSize(first_file) <> -1
Protected.i file_nr = ReadFile(#PB_Any,first_file)
Protected.s file_text = ReadString(file_nr,#PB_File_IgnoreEOL)
CloseFile(file_nr)
; - Do something with the Data
SetGadgetText(#GAD_EDIT, file_text)
EndIf
Case #PB_Drop_Text
Protected.s text = EventDropText()
; - Do something with the Data
SetGadgetText(#GAD_EDIT, text)
EndSelect
EndProcedure
Procedure openMainWindow()
Protected.i win_width, win_heigt, gad_width, gad_height, pos_x, pos_y
win_heigt = 300
win_width = win_heigt * 2
If OpenWindow(#WIN_MAIN, 0, 0, win_width, win_heigt, "Main Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
pos_x = 0
pos_y = 0
gad_width = win_width / 2
gad_height = win_heigt
CalendarGadget(#GAD_CAL, pos_x, pos_y, gad_width, gad_height)
pos_x + gad_width
EditorGadget(#GAD_EDIT, pos_x, pos_y, gad_width, gad_height)
EnableGadgetDrop(#GAD_CAL,#PB_Drop_Files,#PB_Drag_Copy | #PB_Drag_Link | #PB_Drag_Move )
EnableGadgetDrop(#GAD_CAL,#PB_Drop_Text ,#PB_Drag_Copy | #PB_Drag_Link | #PB_Drag_Move )
EndIf
EndProcedure
Define event
openMainWindow()
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_CloseWindow
End
Case #PB_Event_GadgetDrop
onDrop()
EndSelect
ForEver