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
    • CommentTimeMar 5th 2017
     
    Hello,
    I don't understand the Loop NKT_IsWIndows?
    why are my NTK_Lastkey() not working!
    If I press K_F_10 it should my show a value on the same windows but nothing append!
    same with K_RETURN the SatusBar do not show me the message "RETURN!"
    Do I have to make some refresh?
    Regards
    Otto

    ...
    @ 100,354 GET vDiam1 ID GET_D1 ;
    SIZE 22,50 ;
    STYLE GS_3DSUNKEN ;
    VALID NotBlank(vDiam1) ;
    PICTURE "99999"
    ... etc.
    hStatBar := CreateStatusWindow( WS_CHILD+WS_VISIBLE, "Your status bar message.", hWnd, WM_USER+100 ) // Work well

    ACTIVATE WINDOW hWnd NORMAL

    do while NTK_IsWindow(hWnd)
    READ INTO hWnd ;
    START FROM 1 ;
    BUTTON LIST aBtnList ;
    MSG FONT hObjfont2 ;
    MSG AT 430,1,630 ; // Pas compris / Place the help message X,Y,Width
    MSG COLOR NTK_RGB(000,000,000) // Pas compris / Help Text foreground will be black

    do case
    case NTK_LastKey()==K_F10 // will not displayed
    AffCalc()

    case NTK_LastKey()==K_ESC .OR. NTK_LastKey()==K_ALT_F4
    if DoExit()
    exit
    end

    case NTK_LastKey()==K_RETURN // will not displayed
    SetStatusBarMsg(hStatBar,"RETURN!") // Just for test
    end
    enddo


    // Show calculation
    //
    FUNCTION AffCalc(hwnd)
    SET COLOR TO R+/W+
    @ 80,600 SAY Str(vDiam1,6) // Not displayed, just for test!
    Return(nil)
    •  
      CommentAuthorAbbougaga
    • CommentTimeMar 6th 2017 edited
     
    Hi Otto,

    >
    >Hello,
    >I don't understand the Loop NKT_IsWIndows?
    It prevents your program to turn into an endless loop in case another event kills (menu, button, thread, etc.) your modal dialog.

    Placing a 'READ' command into a loop can sometimes be useful when it is needed to do particular checks after READing GETs that may result in re-entering into the 'READ' and immediately start from the specified GET. See sample below.
    But as you only have one GET, I don't see any reasons.

    >why are my NTK_Lastkey() not working!
    No it works - but probably not the way you'd expected. ;)

    >If I press K_F_10 it should my show a value on the same windows but nothing append!
    As shown in 'SET GLOBAL VALIDATION KEY' documentation, you should always test on the NTK_GET_GVK constant.
    Indeed, during a Read session, the Global Validation Key inihibits and superseds the K_* scancode on which it is set.

    >same with K_RETURN the SatusBar do not show me the message "RETURN!"
    Your program will never pass the 'case NTK_LastKey()==K_RETURN' unless you allow the READ
    command to exit (from the first or last GET) via Enter, Up, Dn, PgUp or PgDn in addition to ESC and GVK keys.
    To do so place the instruction NTK_ReadExit(.T.) before your READ. similar to Clipper ReadExit().
    Once again refer to the doc.

    >Do I have to make some refresh?
    >Regards
    >Otto
    >

    Hope this helps
    Ab

    . . .
    @ 50,354 GET vVar1 ID GET_V1 . . .   // #1
    
    @ 80,354 GET vVar2 ID GET_V2 . . .   // #2
    
    @ 100,354 GET vDiam1 ID GET_D1 ;     // #3
    SIZE 22,50 ;
    STYLE GS_3DSUNKEN ;
    VALID NotBlank(vDiam1) ;
    PICTURE "99999" ;
    MESSAGE "Enter a value for vDIAM1" // <==Don't forget this if U want MSG AT to show something!
    
    ... etc.
    hStatBar := CreateStatusWindow( WS_CHILD+WS_VISIBLE, "Your status bar message.", hWnd, WM_USER+100 ) // Work well
    
    ACTIVATE WINDOW hWnd NORMAL
    
    
    // -- .T. Allows or not Up/Dn/Enter Key to exit after last get
    // -- .F. means not allowed. So, we will loop to first get...
    lOldReadState := NTK_ReadExit( .T. )
    
    
    nGetFirst := 1
    do while NTK_IsWindow(hWnd)
    READ INTO hWnd ;
    START FROM nGetFirst ;
    BUTTON LIST aBtnList ;
    MSG FONT hObjfont2 ;
    MSG AT 430,1,630 ; // Pas compris / Place the help message X,Y,Width
    MSG COLOR NTK_RGB(000,000,000) // Pas compris / Help Text foreground will be black
    
    do case
    //case NTK_LastKey()==K_F10 // will not displayed
    CASE NTK_LastKey()==NTK_GET_GVK // Global Validation Key inihibits and superseds K_F10 or K_*
    AffCalc()
    
    case NTK_LastKey()==K_ESC .OR. NTK_LastKey()==K_ALT_F4
    if DoExit()
    exit
    end
    
    case NTK_LastKey()==K_RETURN // will not displayed
    SetStatusBarMsg(hStatBar,"RETURN!") // Just for test
    
    end
    
    
    // example: Check-out vDiam1 after exiting READ
    if vDiam1 <= 10
       NTK_MessageBox(hWnd, "Enter a value greater than 10", "vDiam1:", MB_OK )
       nGetFirst := 3   // re-enter READ with focus on 3rd GET.
    endif
    
    enddo
    
    NTK_ReadExit( lOldReadState )
    
    . . .
    
    
    
    •  
      CommentAuthorohaldi
    • CommentTimeMar 6th 2017
     
    Many thanks for your help.
    Work wonderful!
Add your comments
  • Format comments as