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.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorohaldi
    • CommentTimeFeb 4th 2017 edited
     
    Hello,

    I just bought NTK and like to change the Error system to my own function.
    I added after my main function a new ErrorBlock()! But do not Work.
    Sample:
    FUNCTION MAIN()
    Local cFrameTitle := "GESTION DES EQUIPEMENTS"
    Local oOldError := ErrorBlock({|oError| DefError(oError)})
    etc.

    But, in case of one error I still get the error screen from NTK!
    With my old xHarbour environnement, I didn't have had any problem!
    Many thanks for your help
    Otto
    •  
      CommentAuthorxbasefan
    • CommentTimeFeb 5th 2017 edited
     
    quite normal your instruction is not at the right place and has no effect.
    user-defined errorsystem must be invoked after NTK initialization.
    rather try code like this:
    FUNCTION MAIN()
    Local cFrameTitle := "GESTION DES EQUIPEMENTS"
    Local oOldError 
    
    . . .
    CREATE WINDOW MAIN hWndMain ...
    
    oOldError := ErrorBlock({|oError| DefError(oError)})
    *ErrorSys()  // same usage
    
    
    etc.
    
    . . .
    

    btw, your old xhrb/console errorsys.prg may need some minor arrangements in order to work properly with GUI functions like Alert(),NtkWarnBox() or NTK_MessageBox(). see attachements.
    wilson
    •  
      CommentAuthorohaldi
    • CommentTimeFeb 7th 2017 edited
     
    Many thanks for your help
    In my Main.prg in case of one error it should call my Function DefError in Error.prg.
    To test this function I have only the following code to open a new window.
    But I still get the message : "Can not create Error Window!"
    Question : Why NTK_CreateWindowEx, I also tested with NTK_CreateWindow do not work?
    Tested only with a call to this function : Case nMenuItem == IDM_ERROR call DefError()

    FUNCTION DefError()
    Local hWnd
    hWnd = NTK_CreateWindowEx( WS_EX_WINDOWEDGE , " NTKFEN " ,;
    "Hello Debug",;
    F_MIN + F_MAX + WS_SYSMENU ,;
    0, 0, 640 , 480 )
    if hWnd == 0
    NTK_MsgBox ( , " Can not create Error Window! " ,;
    " Alert ", MB_OK + MB_TOPMOST )
    endif
    RETURN ( Nil )
    •  
      CommentAuthorxbasefan
    • CommentTimeFeb 8th 2017 edited
     
    hmmm, i suspect you did not make any NTK_RegisterClassEx()for NTKFEN class.
    btw, don't see in this code anything for displaying and handling events of your wnd.

    fyi: if you plan to use ntkcore for programming windows the 'traditional manner', i suggest you to prior buy the Petzold's book and explore samples in ./ntkcore dir. imo, demomult.prg should be a good start.
    wilson
    •  
      CommentAuthorohaldi
    • CommentTimeFeb 8th 2017
     
    Many thanks for your help.
    I forgot to make a NTK_RegisterClassEx(), now it work well.
    You are right NTKCore is not so easy to understand! Until yet I used GTWVW to make my windows.
    •  
      CommentAuthorxbasefan
    • CommentTimeFeb 9th 2017 edited
     
    ntkcore is pure W32 API programming. fast & powerful but a little bit more tricky than ntkrad.
    it even allows you to copy-paste windows C/MFC code and make it run with minor adaptations.
    exactly as my clip-4-win in the past, but now we have access to latest windows cutting-edge technologies.
    wilson
    •  
      CommentAuthorAbbougaga
    • CommentTimeFeb 9th 2017
     
    Hi there:

    >ntkcore is pure W32 API programming. fast & powerful but a little bit more tricky than ntkrad.
    I agree, but NTKRad's managed code is easier to learn and syntax is far more similar to Clipper 5.
    No need to RegisterClass, no WndProc hassle, no need to figure out complicated Win32 concepts and so on.
    BTW, if needed, NTKRad also supports NTKCore functions and gives the opportunity to attach the ON MSG clause
    to your CREATE WINDOW... for handling some events.


    ohaldi:
    Why not use a simple CREATE WINDOW hWnd TITLE 'MyTitle' instead of Win32 NTK_RegisterClassEx()+NTK_CreateWindowEx() fn?
    Just have a look to the attached hello.prg. (just 'MKRAD hello' to try it)
    It only took me less me than 10 mn to reorganize your DefError() snippet with a CREATE WINDOW, then
    add it a couple buttons and finally insert all this stuff within the famous Hello1.prg
    from NTKrad's tutorials..........and hey presto!
    BR,
    Ab.
    •  
      CommentAuthorohaldi
    • CommentTimeFeb 10th 2017
     
    First many thanks for your help and your code sample.
    I just started to use NTK. To start with NTKcore is perhaps one error.
    I will follow your idea just using NTKRad's management.
    Regards
    Otto