StdCmds.OpenAuxDialog Trapped

Post Reply
User avatar
René-René
Posts: 3
Joined: Thu Jul 18, 2024 5:52 am

StdCmds.OpenAuxDialog Trapped

Post by René-René »

In all versions of BlackBox, if you try to open a regular textfile using StdCmds.OpenAuxDialog, you get:

TRAP 21 (precondition violated)
HostPorts.Port.SetSize [00000076H]
.h INTEGER -34
.p HostPorts.Port [02A876E0H]
.w INTEGER 638

Try for example: <Ctrl-Q>"StdCmds.OpenAuxDialog('BlackBox_1.7.3-a1_Changes.odc', 'TEST')"

The above-mentioned trap appears twice. Even more, regardless of the trap the file opens correctnly.

Please note that this is not a matter of when is appropriate to use OpenAuxDialog, OpenDoc or other open command variant; the point is that there seems to be an old bug living there.
Josef Templ
Posts: 263
Joined: Tue Sep 17, 2013 6:50 am

Re: StdCmds.OpenAuxDialog Trapped

Post by Josef Templ »

I do agree that the behavior is suboptimal.
The docu should state that the file parameter must be a dialog (Form) document, a text doesn't work properly.
It seems that there is some problem with getting a proper window size if a text document is used as a dialog.

- Josef
luowy
Posts: 88
Joined: Thu Dec 17, 2015 1:32 pm

Re: StdCmds.OpenAuxDialog Trapped

Post by luowy »

The bug is in the HostWindows.DocWinHandler:

Code: Select all

| WinApi.WM_SIZE:
  ....
  Kernel.Try(SizeWin, wnd, lParam MOD 65536, lParam DIV 65536 MOD 65536) (* add MOD 65536 *)
also, the DialogHandler need same fix

Code: Select all

| WinApi.WM_SIZE:
  w := ThisWindow(wnd);
  Kernel.Try(SizeWin, wnd, lParam MOD 65536 + w.dw, lParam DIV 65536 MOD 65536 + w.dh)
User avatar
Ivan Denisov
Posts: 365
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: StdCmds.OpenAuxDialog Trapped

Post by Ivan Denisov »

Added this fix to BlackBox 2.0
Post Reply