Comments (2)
Checking the wxWidgets header files seems that wxEVT_GRID_CMD_RANGE_SELECT doesn't exists so the correct one to use is wxEVT_GRID_RANGE_SELECT.
I'm not really sure what you want to do but the range select event is when you want to select the values of various rows at the same time. If you want to select the values of some cells for the current row wxEVT_GRID_SELECT_CELL would be a better choice. Also remember that every function which is connected to an event, will receive an event object of the type of that event. Here I did some small fix to the code you shared to make it work and the selected function receives a wxGridEvent object. You can use var_dump($event) to know which event type is being passed.
By the way, is interesting how you are doing the coding :) you are making use of the library in a structured form more than its OO nature, which is good for small test scripts.
<?php
$main = new wxFrame(null, wxID_TOP, "Title" );
$vbox = new wxBoxSizer(wxVERTICAL);
$grid = new wxGrid($main, wxID_ANY );
$grid->Connect(wxEVT_GRID_SELECT_CELL, array(wxID_TOP, "selected") );
$grid->CreateGrid(3, 3);
$grid->SetCellValue(0, 0, "x");
$grid->SetCellValue(0, 1, "y");
$grid->SetCellValue(0, 2, "z");
$grid->SetCellValue(1, 0, "a");
$grid->SetCellValue(1, 1, "b");
$grid->SetCellValue(1, 2, "c");
$grid->SetCellValue(2, 0, "d");
$grid->SetCellValue(2, 1, "e");
$grid->SetCellValue(2, 2, "f");
$grid->Layout();
$vbox->Add($grid, 0, wxALL, 10 );
$selectedA = new wxTextCtrl($main, wxID_ANY );
$vbox->Add($selectedA, 0, wxALL, 10 );
$selectedC = new wxTextCtrl($main, wxID_ANY );
$vbox->Add($selectedC, 0, wxALL, 10 );
$main->SetSizer($vbox);
$main->Show();
wxEntry();
function OnInit() { return 1; }
function OnExit() { return 1; }
function selected($event)
{
global $grid, $selectedA, $selectedC;
$selrow = $event->GetRow();
$grid->SelectRow($selrow);
$selectedA->SetValue($grid->GetCellValue($selrow, 0) );
$selectedC->SetValue($grid->GetCellValue($selrow, 2) );
}
?>
from wxphp.
Also remember that every function which is connected to an event, will receive an event object of the type of that event.
That's news to me - that must be what "void handlerFuncName(wxGridRangeSelectEvent& event)" means!
Many thanks.
from wxphp.
Related Issues (20)
- wxArtProvider HOT 1
- wxDatePickerCtrl error on x64 windows build HOT 18
- Tooltips created in wxFormBuilder crash wxPHP HOT 1
- PHP Exceptions not working
- Build for php 7.0 version HOT 2
- xbindkeys and wxTextCtrl()
- Ubuntu 16.04 drops php5 support HOT 7
- macOS build - missing wxwidgets.so HOT 11
- AppImage needs exif extension HOT 3
- Request appimage built with PHP 7.1.0
- How can generate an `.exe` ms window file from `wxphp` php files? HOT 1
- WxPHP for PHP 7 HOT 122
- Difference from WinBinder HOT 6
- wxphp.org is down
- wxHtmlWindow::LoadFile() parameters, LoadPage($url)
- how to hide shell/cmd? HOT 3
- wxDataviewlistctrl method missing HOT 3
- internal zval's can't be arrays, objects or resources HOT 8
- initial set up for first wxphp
- Trying to compile HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wxphp.