// use wa1pfolders.pkg // UI wa1p folder stuff use wa1pfolders.nui use aps use GridUtil.utl // Grid and List utilities (not for dbGrid's or Table's) object oWa1pXmlOpenFileDialog is a aps.ModalPanel set locate_mode to CENTER_ON_SCREEN set Border_Style to BORDER_THICK // Make panel resizeable on_key ksave_record send close_panel_ok on_key kcancel send close_panel property integer pbResult object oGrid is a aps.Grid set peAnchors to (anTop+anLeft+anRight+anBottom) set peResizeColumn to rcSelectedColumn // Resize mode (rcAll or rcSelectedColumn) set piResizeColumn to 0 // This is the column to resize send GridPrepare_AddColumn "File name" AFT_ASCII40 send GridPrepare_AddColumn "Last edit" AFT_ASCII20 send GridPrepare_Apply self set select_mode to NO_SELECT on_key KNEXT_ITEM send switch on_key KPREVIOUS_ITEM send switch_back procedure AddFile string lsName date ldDate string lsTime integer liXmlType integer liBase get item_count to liBase send add_item MSG_NONE lsName send add_item MSG_NONE (TS_ConvertToString(TS_Compose(ldDate,lsTime))) set aux_value item liBase to liXmlType end_procedure end_object object oBtn1 is a aps.Multi_Button on_item "OK" send close_panel_ok set peAnchors to (anBottom+anRight) end_object object oBtn2 is a aps.Multi_Button on_item "Cancel" send close_panel set peAnchors to (anBottom+anRight) end_object send aps_locate_multi_buttons procedure close_panel_ok set pbResult to DFTRUE send close_panel end_procedure property string psName property string psNameRoot property integer piXmlType function ipopup.s string lsCaption returns integer integer liBase liXmlType string lsName set label to lsCaption set pbResult to DFFALSE send Grid_SetEntryState (oGrid(self)) false send Grid_SortByColumn (oGrid(self)) 0 set psName to "" set piXmlType to 0 if (item_count(oGrid)) begin send popup if (pbResult(self)) begin get Grid_BaseItem (oGrid(self)) to liBase get value of oGrid item liBase to lsName set psNameRoot to lsName get aux_value of oGrid item liBase to liXmlType get wa1p_xml_full_filename liXmlType lsName to lsName set psName to lsName set piXmlType to (aux_value(oGrid,liBase)) function_return true end end else begin error 321 "No files available" end function_return false end_function procedure DoReset send delete_data of oGrid end_procedure procedure DoAddType integer liXmlType send wa1p_xml_callback_files liXmlType MSG_AddFile (oGrid(self)) end_procedure end_object // oWa1pXmlOpenFileDialog send aps_SetMinimumDialogSize (oWa1pXmlOpenFileDialog(self)) // Set minimum size procedure wa1p_xml_select_file_reset global send DoReset of oWa1pXmlOpenFileDialog end_procedure procedure wa1p_xml_select_file_add_type global integer liXmlType send DoAddType of oWa1pXmlOpenFileDialog liXmlType end_procedure function wa1p_xml_select_file global string lsCaption returns integer function_return (iPopup.s(oWa1pXmlOpenFileDialog,lsCaption)) end_function function wa1p_xml_selected_name global returns string function_return (psName(oWa1pXmlOpenFileDialog)) end_function function wa1p_xml_selected_rootname global returns string function_return (psNameRoot(oWa1pXmlOpenFileDialog)) end_function function wa1p_xml_selected_xmltype global returns integer function_return (piXmlType(oWa1pXmlOpenFileDialog)) end_function // ---------------------------------------------------------------------------- object oWa1pXmlSaveAsFileDialog is a aps.ModalPanel set locate_mode to CENTER_ON_SCREEN set Border_Style to BORDER_THICK // Make panel resizeable on_key ksave_record send close_panel_ok on_key kcancel send close_panel property integer pbResult object oGrid is a aps.Grid set peAnchors to (anTop+anLeft+anRight+anBottom) set peResizeColumn to rcSelectedColumn // Resize mode (rcAll or rcSelectedColumn) set piResizeColumn to 0 // This is the column to resize send GridPrepare_AddColumn "File name" AFT_ASCII40 send GridPrepare_AddColumn "Last edit" AFT_ASCII20 send GridPrepare_Apply self set select_mode to NO_SELECT on_key KNEXT_ITEM send switch on_key KPREVIOUS_ITEM send switch_back procedure AddFile string lsName date ldDate string lsTime integer liXmlType integer liBase get item_count to liBase send add_item MSG_NONE lsName send add_item MSG_NONE (TS_ConvertToString(TS_Compose(ldDate,lsTime))) set aux_value item liBase to liXmlType end_procedure procedure row_change integer liRowFrom integer liRowTo integer liBase liXmlType string lsName if (focus(desktop)=self) begin get Grid_RowBaseItem self liRowTo to liBase get value item liBase to lsName get aux_value item liBase to liXmlType send UpdateForm lsName liXmlType end end_procedure procedure item_change integer liItm1 integer liItm2 returns integer local integer liRval liColumns get Grid_Columns self to liColumns forward get msg_item_change liItm1 liItm2 to liRval if (liItm1/liColumns) ne (liItm2/liColumns) send row_change (liItm1/liColumns) (liItm2/liColumns) procedure_return liRval end_procedure end_object send aps_goto_max_row object oSaveAsName is a aps.Form abstract AFT_ASCII40 label "File name:" set peAnchors to (anLeft+anRight+anBottom) end_object procedure UpdateForm string lsName integer liXmlType set value of oSaveAsName item 0 to lsName end_procedure object oBtn1 is a aps.Multi_Button on_item "OK" send close_panel_ok set peAnchors to (anBottom+anRight) end_object object oBtn2 is a aps.Multi_Button on_item "Cancel" send close_panel set peAnchors to (anBottom+anRight) end_object send aps_locate_multi_buttons procedure close_panel_ok set pbResult to DFTRUE send close_panel end_procedure property string psName property string psNameRoot property integer piXmlType function ipopup.ss string lsCaption string lsSuggestName returns integer integer liBase liXmlType string lsName set label to lsCaption set pbResult to DFFALSE set value of oSaveAsName item 0 to lsSuggestName send Grid_SetEntryState (oGrid(self)) false send Grid_SortByColumn (oGrid(self)) 0 set psName to "" set piXmlType to 0 send popup if (pbResult(self)) begin get Grid_BaseItem (oGrid(self)) to liBase get value of oGrid item liBase to lsName set psNameRoot to lsName get aux_value of oGrid item liBase to liXmlType get wa1p_xml_full_filename liXmlType lsName to lsName set psName to lsName set piXmlType to (aux_value(oGrid,liBase)) function_return true end function_return false end_function procedure DoReset send delete_data of oGrid end_procedure procedure DoAddType integer liXmlType send wa1p_xml_callback_files liXmlType MSG_AddFile (oGrid(self)) end_procedure end_object // oWa1pXmlSaveAsFileDialog send aps_SetMinimumDialogSize (oWa1pXmlSaveAsFileDialog(self)) // Set minimum size function wa1p_xml_saveas_filename global string lsCaption string lsSuggestName returns integer function_return (iPopup.ss(oWa1pXmlSaveAsFileDialog,lsCaption,lsSuggestName)) end_function