Example #1
0
 function OnGridCellLeftClick($event)
 {
     if ($event->GetCol() == 4) {
         wxMessageBox("Row: " . $event->GetRow());
     }
     $event->Skip();
 }
Example #2
0
 protected function checkFolderExists()
 {
     $path = $this->getWatchFolder();
     if (!is_dir($path)) {
         $ok = mkdir($path);
         if (!$ok) {
             wxMessageBox("Unable to create folder to watch:" . $path);
         }
     }
     if (is_dir($path)) {
         $this->logger("Created watch folder OK");
     }
 }
Example #3
0
 public function onButtonClick($event)
 {
     $buttonCtrl = wxDynamicCast($event->GetEventObject(), "wxButton");
     // We use the element names to recognise them - easier than using IDs
     $message = null;
     if ($buttonCtrl->GetName() === self::ELMT_CANCEL) {
         $message = "Clicked cancel: this would normally close the dialogue without taking any action";
     } elseif ($buttonCtrl->GetName() === self::ELMT_OK) {
         $message = "Clicked OK: this would normally close the dialogue and take the usual action (e.g. creating a diary entry)";
     }
     // If we have a message, let's see it
     if ($message) {
         wxMessageBox($message);
     }
 }
Example #4
0
 function OnInit()
 {
     global $mf;
     $mf = new mainFrame();
     $value = wxMessageBox("Show the frame?", "", wxYES_NO, $mf);
     if ($value == wxYES) {
         $mf->Show();
         $mf->Centre();
         //Static Method Call Test
         $window = wxWindow::FindWindowById(10);
         //Dynamic cast test
         $window = wxDynamicCast($window, "wxFrame");
         print $window->GetTitle() . "\n";
     } else {
         $mf->Close();
     }
     return 0;
 }
Example #5
0
 function NotificationsCheckout($event)
 {
     foreach ($this->messages as $message) {
         $client_position = $message[0];
         $action = $message[1];
         $data = $message[2];
         switch ($action) {
             case "file_transfer":
                 if (wxMessageBox("Accept {$data}?", "File Transfer", wxYES_NO) == wxYES) {
                     $fileDialog = new wxFileDialog($this, "Select output file", "", "", "All Files(*.*)|*.*", wxFD_SAVE);
                     $fileDialog->SetFilename($data);
                     $fileDialog->ShowModal();
                     $this->files_to_store[$client_position] = $fileDialog->GetPath();
                     $message = "accept_file,";
                     socket_write($this->m_user_sockets[$client_position], $message, strlen($message));
                 } else {
                     $message = "cancel_file,";
                     socket_write($this->m_user_sockets[$client_position], $message, strlen($message));
                 }
                 break;
         }
     }
     $this->messages = array();
 }
Example #6
0
 function onAbout()
 {
     wxMessageBox("Welcome to wxPHP!!\nBased on wxWidgets " . WXWIDGETS_LIBRARY_VERSION . "\n\nThis is a minimal wxPHP sample!", "About box...");
 }
Example #7
0
 function onConvertClick($event)
 {
     if ($this->m_pdfList->GetCount() == 0) {
         wxMessageBox("You need to add some files first");
     } else {
         $this->fileNavigator->Disable();
         $this->m_clear->Disable();
         $this->m_convert->Disable();
         $this->m_outpurDir->Disable();
         $total = $this->m_pdfList->GetCount();
         $documents = array();
         $output_dir = $this->m_outpurDir->GetPath();
         for ($i = 0; $i < $total; $i++) {
             $documents[] = $this->m_pdfList->GetString($i);
         }
         $this->converting = true;
         $this->m_timer->Start(500);
         $this->document_converter->SetDocuments($documents, $output_dir);
         $this->document_converter->Create();
         $this->document_converter->Run();
     }
 }
Example #8
0
 function confirm($message, $title = 'Confirm')
 {
     $answer = \wxMessageBox($message, $title, wxYES_NO);
     return $answer === wxYES;
 }
Example #9
0
 function onBackupCompany($event)
 {
     $fileDialog = new \wxFileDialog($this, _("Backup to output file"), "", "", "Xiaris Company File|*.xia", wxFD_SAVE);
     if ($fileDialog->ShowModal() != wxID_CANCEL) {
         $path = str_ireplace(".xia", "", $fileDialog->GetPath());
         $fileDialog->Destroy();
         $path .= ".xia";
         if (file_exists($path)) {
             if (wxMessageBox(_("The file already exists. Do you want to overwrite it?"), _("Warning!"), wxYES_NO) != wxYES) {
                 print "test";
                 return;
             }
         }
         copy($this->company->GetFilePath(), $path);
     }
 }
Example #10
0
 function OnMenuStub($event)
 {
     $editor = new FileViewer($this);
     $stub = "";
     try {
         $stub .= $this->phar_file->phar->getStub();
     } catch (Exception $ex) {
         $stub = "#!/usr/bin/php\n" . "<?php\n\n" . "//Insert your code here\n\n" . "__HALT_COMPILER();\n" . "?>\n";
     }
     $stub_md5 = md5($stub);
     $editor->AddText($stub);
     $editor->editor->SetReadOnly(false);
     $editor->SetMode(FileViewer::MODE_PHP);
     $title = $this->phar_file->name . " stub";
     if (!$this->phar_file->phar->canWrite()) {
         $title .= " (read only)";
     }
     $editor->SetTitle($title);
     $editor->ShowModal();
     if ($this->phar_file->phar->canWrite()) {
         $new_stub_md5 = md5($editor->editor->GetText());
         if ($stub_md5 != $new_stub_md5) {
             $result = wxMessageBox("Do you want to save the changes?", "Stub Changes", wxYES_NO, $this);
             if ($result == wxYES) {
                 try {
                     $this->phar_file->phar->setStub($editor->editor->GetText());
                 } catch (Exception $ex) {
                     wxMessageBox($ex->getMessage());
                 }
             }
         }
     }
 }