I have a form with three sets of columns which have to be filled
out by the user, who has to select from menus (listboxes) what is
to go into each. Since this is a rather full house screen, I
create the same listbox and a couple of controls for each set of
columns, select an item and then, after removing the subclassing
of the listbox, kill the lot and recreate for the next column.
The shape and size of these differ from column to column, but
the same equates are used in each case. The code looks like this:
[code]n&=jbs&
If n&>20 Then n&=20
n&=n&*10+1
Style&=%LBS_STANDARD Or %LBS_HASSTRINGS Or %LBS_NOINTEGRALHEIGHT _
Or %LBS_USETABSTOPS Xor %LBS_SORT
Control Add Label, hDlg&, %TDcbgLbl, "" , 14, 14, 183, 265
Control Add Frame, hDlg&, %TDccnFrm, dnm$, 18, 18, 175, n&+38
Control Send hDlg&, %TDccnFrm, %WM_SETFONT, shFont&, 1
Control Add ListBox, hDlg&, %TDccnLbx,, 30, 32, 152, n&, Style&
Control Send hDlg&, %TDccnLbx, %WM_SETFONT, mnFont&, 1
Control Handle hDlg&, %TDccnLbx To hCtl&
CmnWndProc& = SetWindowLong(hCtl&, %GWL_WNDPROC, CodePtr(CcnMnuSubProc))
Control Add Button, hDlg&, %TDccxBtn, "Exit", 78, n&+34, 50, 18
Control Send hDlg&, %TDccxBtn, %WM_SETFONT, mnFont&, 1
For i&=1 To jbs&
t$=job$(i&)
Replace Chr$(179) With " " In t$
If Val(Left$(t$,4))<10 Then t$=" "+t$
ListBox Add hDlg&, %TDccnLbx, t$
Next
Control Disable hDlg&, %TDtdkBtn
Control Disable hDlg&, %TDextBtn[code]
This works very well the first time through, but when all
colummns have been completed, and I go back to start a new line
below the first, the listbox no longer responds to either the
ENTER key nor double click as for the first time through.
I find nothing in Petzold to explain this. Any help would be
greatly appreciated!
------------------
out by the user, who has to select from menus (listboxes) what is
to go into each. Since this is a rather full house screen, I
create the same listbox and a couple of controls for each set of
columns, select an item and then, after removing the subclassing
of the listbox, kill the lot and recreate for the next column.
The shape and size of these differ from column to column, but
the same equates are used in each case. The code looks like this:
[code]n&=jbs&
If n&>20 Then n&=20
n&=n&*10+1
Style&=%LBS_STANDARD Or %LBS_HASSTRINGS Or %LBS_NOINTEGRALHEIGHT _
Or %LBS_USETABSTOPS Xor %LBS_SORT
Control Add Label, hDlg&, %TDcbgLbl, "" , 14, 14, 183, 265
Control Add Frame, hDlg&, %TDccnFrm, dnm$, 18, 18, 175, n&+38
Control Send hDlg&, %TDccnFrm, %WM_SETFONT, shFont&, 1
Control Add ListBox, hDlg&, %TDccnLbx,, 30, 32, 152, n&, Style&
Control Send hDlg&, %TDccnLbx, %WM_SETFONT, mnFont&, 1
Control Handle hDlg&, %TDccnLbx To hCtl&
CmnWndProc& = SetWindowLong(hCtl&, %GWL_WNDPROC, CodePtr(CcnMnuSubProc))
Control Add Button, hDlg&, %TDccxBtn, "Exit", 78, n&+34, 50, 18
Control Send hDlg&, %TDccxBtn, %WM_SETFONT, mnFont&, 1
For i&=1 To jbs&
t$=job$(i&)
Replace Chr$(179) With " " In t$
If Val(Left$(t$,4))<10 Then t$=" "+t$
ListBox Add hDlg&, %TDccnLbx, t$
Next
Control Disable hDlg&, %TDtdkBtn
Control Disable hDlg&, %TDextBtn[code]
This works very well the first time through, but when all
colummns have been completed, and I go back to start a new line
below the first, the listbox no longer responds to either the
ENTER key nor double click as for the first time through.
I find nothing in Petzold to explain this. Any help would be
greatly appreciated!
------------------
Comment