]> git.saurik.com Git - wxWidgets.git/commitdiff
dbgrid.cpp dbgrid.h bitmaps/logo.xpm
authorMark Johnson <mj10777@web.de>
Fri, 25 Feb 2000 12:01:38 +0000 (12:01 +0000)
committerMark Johnson <mj10777@web.de>
Fri, 25 Feb 2000 12:01:38 +0000 (12:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6281 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

demos/dbbrowse/bitmaps/logo.xpm
demos/dbbrowse/dbgrid.cpp
demos/dbbrowse/dbgrid.h

index c7aaa6599c9a5b451127c15eab6bee1b9cfd2d84..f7b075b6dcf403b319481fcb17aa881814005c6e 100644 (file)
@@ -1,5 +1,5 @@
 /* XPM */\r
 /* XPM */\r
-static char* Logo_xpm[] = {\r
+static char* aLogo_xpm[] = {\r
 "16 16 4 1",\r
 "  c #000000",\r
 "! c #C0C0C0",\r
 "16 16 4 1",\r
 "  c #000000",\r
 "! c #C0C0C0",\r
index 509f12ec112b6d8db2f197f0dcede67600c0f36b..c54e3b4a44012856566d6a396565ad8bcbba2e45 100644 (file)
 BEGIN_EVENT_TABLE(DBGrid, wxGrid)
  EVT_MOTION (DBGrid::OnMouseMove)
  // DBGrid
 BEGIN_EVENT_TABLE(DBGrid, wxGrid)
  EVT_MOTION (DBGrid::OnMouseMove)
  // DBGrid
- EVT_GRID_LABEL_LEFT_CLICK( DBGrid::OnLabelLeftClick )
- EVT_GRID_LABEL_RIGHT_CLICK( DBGrid::OnLabelRightClick )
- EVT_GRID_LABEL_LEFT_DCLICK( DBGrid::OnLabelLeftDClick )
- EVT_GRID_LABEL_RIGHT_DCLICK( DBGrid::OnLabelRightDClick )
+ // ------------
+ EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange )
  EVT_GRID_CELL_LEFT_CLICK( DBGrid::OnCellLeftClick )
  EVT_GRID_CELL_LEFT_CLICK( DBGrid::OnCellLeftClick )
- EVT_GRID_CELL_RIGHT_CLICK( DBGrid::OnCellRightClick )
  EVT_GRID_CELL_LEFT_DCLICK( DBGrid::OnCellLeftDClick )
  EVT_GRID_CELL_LEFT_DCLICK( DBGrid::OnCellLeftDClick )
+ EVT_GRID_CELL_RIGHT_CLICK( DBGrid::OnCellRightClick )
  EVT_GRID_CELL_RIGHT_DCLICK( DBGrid::OnCellRightDClick )
  EVT_GRID_CELL_RIGHT_DCLICK( DBGrid::OnCellRightDClick )
- EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
  // EVT_GRID_COL_SIZE( DBGrid::OnColSize )
  // EVT_GRID_COL_SIZE( DBGrid::OnColSize )
+ // EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
+ EVT_GRID_EDITOR_SHOWN( DBGrid::OnEditorShown )
+ EVT_GRID_EDITOR_HIDDEN( DBGrid::OnEditorHidden )
+ EVT_GRID_LABEL_LEFT_CLICK( DBGrid::OnLabelLeftClick )
+ EVT_GRID_LABEL_LEFT_DCLICK( DBGrid::OnLabelLeftDClick )
+ EVT_GRID_LABEL_RIGHT_CLICK( DBGrid::OnLabelRightClick )
+ EVT_GRID_LABEL_RIGHT_DCLICK( DBGrid::OnLabelRightDClick )
  EVT_GRID_RANGE_SELECT( DBGrid::OnRangeSelected )
  EVT_GRID_RANGE_SELECT( DBGrid::OnRangeSelected )
- EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange )
+ EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
+ EVT_GRID_SELECT_CELL( DBGrid::OnSelectCell )
  EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit)
  EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse)
 END_EVENT_TABLE()
  EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit)
  EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse)
 END_EVENT_TABLE()
@@ -59,7 +64,7 @@ END_EVENT_TABLE()
 DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
   wxGrid(parent, id, pos, size, style)
 {
 DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
   wxGrid(parent, id, pos, size, style)
 {
- b_EditModus = TRUE;
+ b_EditModus = FALSE;
  //---------------------------------------------------------------------------------------
  popupMenu1 = new wxMenu("");
  popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
  //---------------------------------------------------------------------------------------
  popupMenu1 = new wxMenu("");
  popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
@@ -78,7 +83,7 @@ int  DBGrid::OnTableView(wxString Table)
  int  i=0,x,y,z, ValidTable=0;
  wxString Temp0;
  wxBeginBusyCursor();
  int  i=0,x,y,z, ValidTable=0;
  wxString Temp0;
  wxBeginBusyCursor();
- SetFont(* pDoc->ft_Doc);
+ SetDefaultCellFont(* pDoc->ft_Doc);
  //---------------------------------------------------------------------------------------
  ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB;                       // Get the DSN Pointer
  //---------------------------------------------------------------------------------------
  //---------------------------------------------------------------------------------------
  ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB;                       // Get the DSN Pointer
  //---------------------------------------------------------------------------------------
@@ -136,7 +141,7 @@ int  DBGrid::OnTableView(wxString Table)
   wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed"));
  //---------------------------------------------------------------------------------------
  Weiter:
   wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed"));
  //---------------------------------------------------------------------------------------
  Weiter:
- SetEditInPlace(b_EditModus);   // Activate in-place Editing (FALSE)
+ EnableEditing(b_EditModus);     // Deactivate in-place Editing
  wxEndBusyCursor();
  //---------------------------------------------------------------------------------------
  wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
  wxEndBusyCursor();
  //---------------------------------------------------------------------------------------
  wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
@@ -146,16 +151,39 @@ int  DBGrid::OnTableView(wxString Table)
 void DBGrid::OnModusEdit(wxMenu& menu, wxCommandEvent& event)
 {
  b_EditModus = TRUE;             // Needed by PopupMenu
 void DBGrid::OnModusEdit(wxMenu& menu, wxCommandEvent& event)
 {
  b_EditModus = TRUE;             // Needed by PopupMenu
- SetEditable(FALSE);             // Do not Edit with Text Edit Control
- SetEditInPlace(b_EditModus);    // Deactivate in-place Editing
+ EnableEditing(b_EditModus);     // Activate in-place Editing
  UpdateDimensions();             // Redraw the Grid
  UpdateDimensions();             // Redraw the Grid
+ // wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End"));
 }
 //----------------------------------------------------------------------------------------
 void DBGrid::OnModusBrowse(wxMenu& menu, wxCommandEvent& event)
 {
  b_EditModus = FALSE;            // Needed by PopupMenu
 }
 //----------------------------------------------------------------------------------------
 void DBGrid::OnModusBrowse(wxMenu& menu, wxCommandEvent& event)
 {
  b_EditModus = FALSE;            // Needed by PopupMenu
SetEditInPlace(b_EditModus);    // Deactivate in-place Editing
EnableEditing(b_EditModus);     // Deactivate in-place Editing
  UpdateDimensions();             // Redraw the Grid
  UpdateDimensions();             // Redraw the Grid
+ // wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
+}
+//----------------------------------------------------------------------------------------
+void DBGrid::OnEditorShown( wxGridEvent& ev )
+{
+ // wxLogMessage(_("-I-> DBGrid::OnEditorShown() - End"));
+ ev.Skip();
+}
+//----------------------------------------------------------------------------------------
+void DBGrid::OnEditorHidden( wxGridEvent& ev )
+{
+ // wxLogMessage(_("-I-> DBGrid::OnEditorHidden() - End"));
+ ev.Skip();
+}
+void DBGrid::OnSelectCell( wxGridEvent& ev )
+{
+ logBuf = "";
+ logBuf << "Selected cell at row " << ev.GetRow()
+        << " col " << ev.GetCol();
+ wxLogMessage( "%s", logBuf.c_str() );
+ // you must call Skip() if you want the default processing
+ // to occur in wxGrid
+ ev.Skip();
 }
 //----------------------------------------------------------------------------------------
 void DBGrid::OnMouseMove(wxMouseEvent &event)
 }
 //----------------------------------------------------------------------------------------
 void DBGrid::OnMouseMove(wxMouseEvent &event)
@@ -188,7 +216,7 @@ void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
 //----------------------------------------------------------------------------------------
 void DBGrid::OnLabelRightClick( wxGridEvent& ev )
 {
 //----------------------------------------------------------------------------------------
 void DBGrid::OnLabelRightClick( wxGridEvent& ev )
 {
- //-------------------
+ //-------------------------------------------------------
  if (b_EditModus)
   PopupMenu(popupMenu2,MousePos.x,MousePos.y);
  else
  if (b_EditModus)
   PopupMenu(popupMenu2,MousePos.x,MousePos.y);
  else
index 81b73d2e9c2642ec3890419bbe0830ffd55f3f70..2cd95d698938fbfd4af2f5c3013719a6b7918772 100644 (file)
@@ -38,18 +38,22 @@ class DBGrid: public wxGrid
  void OnModusBrowse(wxMenu& menu, wxCommandEvent& event);
  void OnMouseMove(wxMouseEvent& event);
  int  OnTableView(wxString Table);
  void OnModusBrowse(wxMenu& menu, wxCommandEvent& event);
  void OnMouseMove(wxMouseEvent& event);
  int  OnTableView(wxString Table);
- void OnLabelLeftClick( wxGridEvent& );
- void OnLabelRightClick( wxGridEvent& );
- void OnLabelLeftDClick( wxGridEvent& );
- void OnLabelRightDClick( wxGridEvent& );
+ //-----
+ void OnCellChange( wxGridEvent& );
  void OnCellLeftClick( wxGridEvent& );
  void OnCellLeftClick( wxGridEvent& );
- void OnCellRightClick( wxGridEvent& );
  void OnCellLeftDClick( wxGridEvent& );
  void OnCellLeftDClick( wxGridEvent& );
+ void OnCellRightClick( wxGridEvent& );
  void OnCellRightDClick( wxGridEvent& );
  void OnCellRightDClick( wxGridEvent& );
- void OnRowSize( wxGridSizeEvent& );
  void OnColSize( wxGridSizeEvent& );
  void OnColSize( wxGridSizeEvent& );
+ void OnEditorShown( wxGridEvent& );
+ void OnEditorHidden( wxGridEvent& );
+ void OnLabelLeftClick( wxGridEvent& );
+ void OnLabelLeftDClick( wxGridEvent& );
+ void OnLabelRightClick( wxGridEvent& );
+ void OnLabelRightDClick( wxGridEvent& );
  void OnRangeSelected( wxGridRangeSelectEvent& );
  void OnRangeSelected( wxGridRangeSelectEvent& );
- void OnCellChange( wxGridEvent& );
+ void OnRowSize( wxGridSizeEvent& );
+ void OnSelectCell( wxGridEvent& );
  //---------------------------------------------------------------------------------------
  DECLARE_EVENT_TABLE()
 };
  //---------------------------------------------------------------------------------------
  DECLARE_EVENT_TABLE()
 };