NTK and The NTK Project
are properties of Jn Dechereux
Home | Documentation | FAQ.
Vanilla 1.1.8 is a product of Lussumo. More Information: Documentation, Community Support.
oB := NtkTBrowse():Init( hTBParent,; 0, 0, aParentRect[RECT_Width], aParentRect[RECT_Height],; "",; WS_CHILD+WS_VISIBLE+WS_VSCROLL ) // WS_CHILD + WS_VISIBLE + WS_OVERLAPPED + WS_THICKFRAME + WS_VSCROLL )
STATIC FUNCTION AdjustBrowseToParent( oB, lUserResize ) Local hWndP Default lUserResize To .F. If !EMPTY(oB) hWndP := oB:hWndParent oB:nubWidth := 120 // we want a 120 px width for nubs // Resize the whole datagrid control (nubs+data cells) according to its parent container dimensions NTK_MoveWindow(oB:hWnd,; oB:nubWidth,; 0,; (__NTKMaxCol(hWndP) - oB:nubWidth),; __NTKMaxRow(hWndP) ,; .T.) if !lUserResize NTK_PostMessage( oB:hWnd, WM_EXITSIZEMOVE, 0, 0 ) endif EndIf RETURN( Nil )
CASE message == WM_SYSCOMMAND IF nwParam == SC_CLOSE // system menu double click, or Alt-F4 NTK_PostQuitMessage(0) ELSEIF nwParam==SC_MAXIMIZE .OR. nwParam==SC_MINIMIZE .OR. nwParam==SC_RESTORE // adjust the child dataGrid/Browse control to its parent container AdjustBrowseToParent( oB ) EndIf **RETURN 0 CASE message == WM_NCLBUTTONDBLCLK // adjust the child dataGrid/Browse control to its parent container AdjustBrowseToParent( oB ) CASE message == WM_SIZE // adjust the child dataGrid/Browse control to its parent container AdjustBrowseToParent( oB )
Hi Alastair,
Glad you like it!
>>U-know.... right-click to reveal a copy/cut/paste (of selected) option.
>>If popping up a menu is too tricky for me just now is enabling Ctrlc, Ctrlx, Ctrl_v easier??
Don't worry about that. Those kinds of facilities are very easy to implement with NTK.
As the owner of a registered NTK Pro license, your package is supplied with the full NTKRad (and other derivate application tools) source code. So, feel free to have a look at the NTKDIC tool and its source code (\wntk4hrb\ntkdic). I think you'll find there your gold mine.
BR,
jnd
p.s.
Are you talking about something like that?
Hi Alastair,
>>I'm busy adapting code from brtest.prg whilst learning from other demo code
>>I'm making good progress)
Great, I'm sure you're on the right way!
>>can you point me in the right direction for me to be able to display a nice tick then edit and
>>save it in a ntktbrowse cell.
If you are wondering about a datagrid object offering checkbox abilities inside cells, like the following:
Just keep in mind there are many different ways to do it. So, as I'm a lazy boy, I'm going to show you one of the easiest.
Just look at the next post.
Hope this will help you.
BR,
Jnd
// Resources for Browse objects. Must be numeric! 1200 BITMAP \myapp\bmp\ChkMark0.bmp /* Blue on White Check Mark OFF */ 1201 BITMAP \myapp\bmp\ChkMark1.bmp /* Blue on White Check Mark ON */
oCol3 := NtkColumn():Init("MyLabel", {||data->MyLogicalField}, nil, NTK_RGB(12,15,46), NTK_RGB(200,200,255), DT_LEFT, 100 )
oCol3 := NtkColumn():Init( "MyLabel", 0, nil, NTK_RGB(12,15,46), NTK_RGB(200,200,255), nil, 45 ) oCol3:Bitmap := {|| IIF( myDbf->MyLogicalField, 1201, 1200) } oCol3:BitAlign := DT_CENTER
// Do edit routine oB:doubleClick := { |oB,nMsg,nWparam,nLparam| DoEditCell(oB) }
FUNCTION DoEditCell( oB ) // ... // Var declarations, here. // ... // We don't need any GET/READ for this cell: // We just alternatively change MyLogicalField state // from true to false (on/off) and so on..... IF oB:ColPos == 3 If .NOT. (oB:Alias)->MyLogicalField REPLACE (oB:Alias)->MyLogicalField WITH .T. ELSE REPLACE (oB:Alias)->MyLogicalField WITH .F. EndIf oB:RefreshCurrent() // Repaint all fields of the current row NTK_SetFocus(oB:hWnd) RETURN(nil) ENDIF // … // // Here comes the default/standard routine regarding to // GET declarations, READ and REPLACE related to // other cells/fields. More explanations in Brtest.prg... // // ... RETURN(nil)
FUNCTION MainToolBar(hWndP) LOCAL hWndTB LOCAL aWndRect := NTK_GetClientRect( hWndP ) // -- DEFINE THE APPLICATION TOOLBAR CONTAINER... CREATE WINDOW hWndTB ; CLASS "ToolbarWindow32" ; STYLE WS_CHILD+WS_VISIBLE+WS_BORDER ; AT 0,0 SIZE aWndRect[Rect_Right],055 ; ON PAINT ToolBarPaint() ; ID IDC_MAIN_TBAR ; INTO PARENT hWndP // -- DEFINE TOOLBAR MEMBERS (buttons) DECLARE TOOLBAR MEMBER INTO aTbBtnList ; ID ID_BTN_OPEN ; CAPTION "[O]"+CR+CR+"&Ouvrir..." ; SUPER ACCEL KEY K_o ; ACTION Import_DB( hWndP ) ; BITMAP UP "rOpen_up" ; BITMAP DN "rOpen_dn" ; BITMAP GRAYED "rOpen_off" ; BITMAP OVER "rOpen_ovr" ; SHIFT TO 6,6 ; TOOLTIP "Ouvrir une table de la base de données"+CR+; "([O] or Alt+O )" DECLARE TOOLBAR MEMBER INTO aTbBtnList ; ID ID_BTN_IMPORT ; CAPTION "[E]"+CR+CR+"&Exporter" ; SUPER ACCEL KEY K_e ; ACTION Export_Dlg( hWndP ) ; BITMAP UP "rExport_up" ; BITMAP DN "rExport_dn" ; BITMAP GRAYED "rExport_off" ; BITMAP OVER "rExport_ovr" ; SHIFT TO 6,6 ; TOOLTIP "Exporter la table courrante vers un "+CR+; "fichier destination au format Excel. ( [E] or Alt+E )" DECLARE TOOLBAR MEMBER INTO aTbBtnList ; ID ID_BTN_QUIT ; CAPTION "[Q]"+CR+CR+"&Quitter" ; SUPER ACCEL KEY K_ESC ; // Do not forget the close msg ACTION NTK_SendCloseEvent( hWndP ) ; // must be sent to the parent Window !! BITMAP UP "rQuit_up" ; BITMAP DN "rQuit_dn" ; BITMAP GRAYED "rQuit_off" ; BITMAP OVER "rQuit_ovr" ; SHIFT TO 6,6 ; TOOLTIP "Fermer et sortir du programme"+CR+; "(Alt+Q ou Esc)" // -- MAKE THE APP TOOLBAR MENU USING THE PREVIOUS DECLARED MEMBERS, THEN CONNECT IT TO THE hWndTB CONTAINER... @ 002,002 CREATE TOOLBAR FROM aTbBtnList ; INTO WINDOW hWndTB ; BUTTON HEIGHT 48 ; BUTTON WIDTH 52 ; BUTTON SPACING 0 ; BUTTON TYPE NTK_BT_OWNERDRAWN ; BUTTON STYLE BS_RIGHT ; BUTTON FONT NTK_GetStockObject(ANSI_VAR_FONT) RETURN(hWndTB) FUNCTION ToolBarPaint(hWnd, message, nwParam, nlParam, hDC) // draw a fancy blue pipe bkg within the Main ToolBar child-window @ 0,0 SAY WALLPAPER ID ID_Pipe01 SIZE 46,__ntkMaxCol(hWnd) TO hWnd INTO CONTEXT hDC // Blue gradient Bar Tube RETURN(0)
1 to 15 of 15