I am converting a very large, MODAL program ( legacy ) to MDI. I've been using Claude and have been very pleased with the results.
On the main screen there is a button bar. One button, Tools ( which controls a drop down menu for setup options, etc. ) we want to maintain as MODAL because any changes there could affect open Windows if that were permitted.
The idea is to make it active, but once a MDI window is opened, it is disabled. When all MDI windows are closed, then we want it to be enabled again. Claude has become exhausted trying to find a solution. Perhaps someone on the forum has dealt with this issue and knows the solution to our problem: When an MDI windows opens the button is disabled. When all windows are closed, the system fails to enable it.
Here is what claude has tried:
Good call. For the forum post, here's a concise summary of what's been tried:
Goal: Disable/gray the Tools button on the main TBar (oReBar) while any MDI child windows are open,
re-enable when all are closed.
Mechanism: DEFINE TIMER ... INTERVAL 400 ... ACTION oReBar:AEvalWhen() + WHEN (condition) clause on
the button.
What works: The button IS disabled when an MDI child opens — so AEvalWhen() fires, bWhen is evaluated,
and Disable() runs correctly.
What doesn't work: The button never re-enables after all MDI children are closed, regardless of what
the WHEN condition checks.
Conditions tried — all failed to restore:
Len( oWnd:oWndClient:aWnd ) == 0 — FiveWin's own tracking array
AScan( oWnd:oWndClient:aWnd, { |o| IsWindow( o:hWnd ) } ) == 0 — filtered for live handles
SendMessage( oWnd:oWndClient:hWnd, 553, 0, 0 ) == 0 — WM_MDIGETACTIVE direct to MDICLIENT
The suspicion is that either AEvalWhen() isn't re-evaluating bWhen after disable, or TBtnBmp:Enable()
isn't fully restoring visual/functional state in the 2015 bar style. The forum may know the correct
pattern for dynamically enabling/disabling a TBar button at runtime.
Here is the current control in the source code:
DEFINE BUTTON oWBtn8 OF oReBar RESOURCE "FIBILD" PROMPT "Tools" ;
ACTION oWbtn8:ShowPopup() MENU oWPopM8 TOOLTIP "Special tools" BTNRIGHT GROUP LABEL "System" ;
WHEN ( oWnd:oWndClient == NIL .OR. SendMessage( oWnd:oWndClient:hWnd, 553, 0, 0 ) == 0 )Does anyone have a solution ?
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit