Announcement

Collapse
No announcement yet.

I need some advise...(again)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Guest's Avatar
    Guest replied
    Thank you so much!


    just incase others are watching here is the change that needs to be made to the message pump.

    Code:
    while GetMessage(msg,%NULL,0,0)
        if IsDialogMessage(hWnd,msg) = 0 then
            call TranslateMessage(msg)
            call DispatchMessage(msg)
        end if
    wend
    NOTE: It is also important to use the %WS_TABSTOP style with each control in the dialog in order to allow tabbing through all of the child controls.

    ------------------
    Cheers

    [This message has been edited by mark smit (edited December 11, 2000).]

    Leave a comment:


  • Lance Edmonds
    replied
    Add a call to IsDialogMessage() in your message pump loop - it will then make the TAB key work to change focus through the child windows/controls. The API name is slightly misleading...


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Guest's Avatar
    Guest started a topic I need some advise...(again)

    I need some advise...(again)

    Hello Everyone!


    Just out of curiosity I wanted to build my own type of "dialog engine" the problem is that I can't get it to "tab" through all the child windows.

    Code:
    #compile exe
    #include "windows.inc"
    
    function EditBox(byval hWndParent as long,_
                     byval ID as long,_
                     byref szText as asciiz,_
                     byval x as long,_
                     byval y as long,_
                     byval w as long,_
                     byval h as long,_
                     byval Style as long,_
                     byval ExtendedStyle as long) export as long
                     
                     
        local hInstance as long
        local hWindow as long
        
        
        
        hInstance = GetWindowLong(hWndParent,%GWL_HINSTANCE)
        hWindow = CreateWindowEx(ExtendedStyle,_
                                 "EDIT",_
                                 szText,_
                                 %WS_CHILD or %WS_VISIBLE or Style,_
                                 x,_
                                 y,_
                                 w,_
                                 h,_
                                 hWndParent,_
                                 ID,_
                                 hInstance,_
                                 byval %NULL)
        
        if hWindow then
            call UpdateWindow(hWindow)
            call SendMessage(hWindow,%WM_SETFONT,GetStockObject(%ANSI_VAR_FONT),%TRUE)
        end if
    end function
    
    
    function WinMain(byval hInstance as long,_
                     byval hPrevInstance as long,_
                     szCmdLine as asciiz ptr,_
                     byval nCmdShow as long) export as long
    
        local szWindowClass as asciiz * 64
        local wcex as WNDCLASSEX
        local msg as TAGMSG
        local hWnd as long
    
    
        szWindowClass       = "TestDialog"
    
        wcex.cbSize         = sizeof(wcex)
        wcex.style          = %CS_HREDRAW or %CS_VREDRAW
        wcex.lpfnWndProc    = codeptr(WindowProc)
        wcex.cbClsExtra     = 0
        wcex.cbWndExtra     = 0
        wcex.hInstance      = hInstance
        wcex.hIcon          = LoadIcon(%NULL,byval %IDI_APPLICATION)
        wcex.hIconSm        = LoadIcon(%NULL,byval %IDI_APPLICATION)
        wcex.hCursor        = LoadCursor(%NULL,byval %IDC_ARROW)
        wcex.hbrBackground  = GetSysColorBrush(%COLOR_3DFACE)
        wcex.lpszClassName  = varptr(szWindowClass)
        wcex.lpszMenuName   = %NULL
    
    
        if RegisterClassEx(wcex) then
            hWnd = CreateWindowEx(%WS_EX_CONTROLPARENT,_
                                  szWindowClass,_
                                  szWindowClass,_
                                  %WS_OVERLAPPEDWINDOW,_
                                  %CW_USEDEFAULT,_
                                  %CW_USEDEFAULT,_
                                  %CW_USEDEFAULT,_
                                  %CW_USEDEFAULT,_
                                  %HWND_DESKTOP,_
                                  %NULL,_
                                  hInstance,_
                                  byval %NULL)
    
            call ShowWindow(hWnd,%SW_NORMAL)
            call UpdateWindow(hWnd)
    
            while GetMessage(msg,%NULL,0,0)
                call TranslateMessage(msg)
                call DispatchMessage(msg)
            wend
    
            function = msg.wParam
        end if
    end function
    
    function WindowProc(byval hWnd as long,_
                        byval Message as long,_
                        byval wParam as long,_
                        byval lParam as long) export as long
                        
                        
        select case (Message)
            case %WM_CREATE
                call EditBox(hWnd,100,"edit1",4,4,200,14,%ES_AUTOHSCROLL,%NULL)
                call EditBox(hWnd,101,"edit2",4,20,200,14,%ES_AUTOHSCROLL,%NULL)
                
                
            case %WM_DESTROY
                call PostQuitMessage(errapi)
            
        end select
        
        function = DefWindowProc(hWnd,Message,wParam,lParam)
    end function

    Just another question, has anybody else been loosing code from the end of there source in PBEDIT?

    ------------------
    Cheers
Working...
X