Focus

Focus

All (Function keys, tab & ) works
well on first pass. Returning to 1st
dialog (Back), Function keys work but
tab and do not... CVF 6.1.
Any thoughts?

Sample Attached.

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Jugoslav Dujic

Please don't get offended, but you have created a real mess out of that sample. The reason why it does not work is that you have just hidden the "Customer" dialog instead of ending it (EndDialog) -- all Tab & Enter keys are directed to "Customer" dialog instead of to "L25" dialog.

Uh, where should I start enumerating problems? First, hotkeys are not for the purpose you used it -- once registered, hotkeys are global to the system, like Alt+Tab or Win+E. I had hard time debugging that code because F5, F9, F10 debugger keys were effectively disabled. Accelerators are used for that kind of stuff. Alternatively, you can handle WM_KEYDOWN in window procedure or even install a global hook (see here).

Next, you have a never-closing modal dialog (L25) within a frame window. The frame window is effectively useless, so why don't just get rid of it? The following is a perfectly valid Windows application:

integer*4 function WinMain( hInstance, hPrevInstance, lpszCmdLine, nCmdShow )
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_WinMain@16' :: WinMain
use dfwin
integer*4 hInstance,hPrevInstance,lpszCmdLine,nCmdShow
include "resource.fd"
!Interface to FunKeyDlgProc
ret = DialogBoxParam(hInstance,L25,NULL,LOC(FunKeyDlgProc),0)
end function

No need for MainWndProc, RegisterClass, CreateWindow...

I suggest that you take a look at dialog-based samples.

Jugoslav

Jugoslav www.xeffort.com

Jugoslav:

First, thank you for your prompt reply and suggestion
for alternatives to hotkeys ( I agree, abundant mouse
clicks required to debug ).

I must also apologize for not setting the rational for
the example. We are attempting to replace software
that has many screens with few entries each ( a
navigation nightmare ) with few screens of many entries
( up to 40+ ). The intent is to create groups of entries
within each screen and use function keys to start within
each group ( I cant imagine tabbing 25 times to get
to the 26th entry & only so many alt keys available ).

The individual screen has a combination of file input
data and results. The (re)population of the screens
is not trivial and considering there may be 50+ seats
attacking the database(server) it would put undue load
on the server as the user traversed back and forth
thru the screens (4 + ? )if we destroyed(Enddata) each
screen, IMHO.

The approach I am attempting here is akin to the VB MDI
project where the Winmain is the MDIparent and L25,
Customer,(...) are child windows which remain open and
traversed by HIDE/SHOW means.

I hope this makes sense and any examples of this
approach would be appreciated. You and other members
of this forum the tops. Thanks again for the interest.

Ralph

Imagen de Jugoslav Dujic

The problem is complex; before starting coding I'd first carefully consider design. Modeless dialogs will be your friends.

As for user interface for that, I like the "property sheet" approach used by many applications for management of complex data structures. Attached is the sample for configuration dialog in Programmer's File Editor (freeware, downloadable here). As you see, all categories are listed on the right pane, and the contents of the left pane change depending on selection in the list. The design of the right panes is most easily achieved as a series of borderless child dialogs (I marked them red). All these dialogs are created as modeless and created on main dialog's startup (CreateDialog); they are all hidden except the active one. Also it can be done with a tab control instead of the list box. Each child dialog should have "child" and "control" styles set.

Here's some semi-pseudo code how would I handle it (in MainDlgProc):

integer:: hPane(17)
integer, parameter:: idPane(17)= &
(/IDD_PANE_CUSTOMER,             &
  IDD_PANE_ADDRESS,              &
...

CASE (WM_INITDIALOG)
  DO i=1,17
    hPane = CreateDialog(ghInst, idPane(i), hWnd, LOC(CommonPaneProc))
  END DO
...
CASE (WM_COMMAND)
  IF (LOWORD(wParam)==IDC_LIST_CATEGORIES .AND. HIWORD(wParam)==LB_SELCHANGED) THEN
    iPos = SendMessage(GetDlgItem(IDC_LIST_CATEGORIES), LB_GETCURSEL, 0, 0) + 1
    DO i=1,17
       IF (i==iPos) THEN
         iSt = ShowWindow(hPane(i), SW_SHOW)
       ELSE
         iSt = ShowWindow(hPane(i), SW_HIDE)
       END IF
    END DO
...
CASE (WM_KEYDOWN)
  !Catch F1...F12 if you like
  IF (wParam>=VK_F1 .AND. wParam<=VK_F12)
    iPos = wParam - VK_F1
    iSt = SendMessage(GetDlgItem(hWnd, IDC_LIST_CATEGORIES), LB_SETCURSEL, iPane, 0)
    !Show/hide appropriate pane

...

You might also list the great Interface Hall of Shame site. It shows you many DOs and DONTs in GUI design using actual examples in a funny way.

Jugoslav

{Sorry, attachment feature of the Forum appears to be defunct at the moment. I'll try later.}

Jugoslav www.xeffort.com
Imagen de Jugoslav Dujic

... here it is

Jugoslav www.xeffort.com

Inicie sesión para dejar un comentario.