Page 1 of 1

StdCmds.OpenAuxDialog Trapped

Posted: Thu Jul 18, 2024 7:26 am
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.

Re: StdCmds.OpenAuxDialog Trapped

Posted: Sun Sep 22, 2024 9:16 am
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

Re: StdCmds.OpenAuxDialog Trapped

Posted: Mon Sep 23, 2024 9:16 am
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)

Re: StdCmds.OpenAuxDialog Trapped

Posted: Sat Nov 09, 2024 10:59 pm
by Ivan Denisov
Added this fix to BlackBox 2.0