Addict Discuss
More teething problems with Addict4
Thread Starter: Roy Lambert Started: 2/12/2009 1:02 PM UTC
Replies: 19
More teething problems with Addict4
Glenn

1.
I thought I'd try the recommended approach and just have a single spellcheck component on a datamodule. Opening at least one form in my app I get a range check error at line 1850 in procedure TAddictEditSubclass.PaintControl( DC:HDC; UpdateRect:TRect );

OldFont�������� := SelectObject( MemDC, SendMessage( FHandle, WM_GETFONT, 0, 0 ) );

I tried downloading the latest version but still the problem

2.
In the app regardless of wether I have a spellcheck component on the page or on the datamodule it seems that TAddictSpellDBMemo components aren't recognised.

I have a main form which has a TAdvOfficePager on it. Subsequent forms are created on the fly and parented�on a page of this component. Any suggestions?

Roy Lambert
Re: More teething problems with Addict4
Glenn


I've just tried a different app in which I'm using V4 and the DBMemo fields in that one are fine so it has to be something in this app. Any suggestions as to what could cause it or am I off on several days of deleting components to track it down?

Roy Lambert
Re: More teething problems with Addict4
Glenn


I think I've sused how to cause the problem with bog standard (apart from Addict) components. You simple create dynamically and parent on a tabpage, or another form. The code I'm using is below. Button 1 then spelldbmemo's aren't "hooked up" and do not underline misspelt words although spelldbedits, spellmemos and spelledits are. With button 2 all are hooked up and the misspellings are highlighted.

I think I've gone as far as I can and now need assistance from the guru <g>


function TForm1.MakeSuplementaryForm(Archetype: TFormClass; TabCaption: string = ''): HWND;
var
tmpForm: TForm;
NewPageNo: integer;
begin
Application.CreateForm(Archetype, tmpForm);
tmpForm.Tag := -1;
tmpForm.BorderIcons := [];
tmpForm.BorderStyle := bsNone;
tmpForm.Parent := tabsheet2;
FormController.ActivePageIndex := 1;
FormController.Tag := 1;
tmpForm.Show;
tmpForm.Align := alClient;
tmpForm.Visible := True;
PostMessage(tmpForm.Handle, FakeFormActivate, 0, 0);
Result := tmpForm.Handle;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
MakeSuplementaryForm(TDiaryForm, 'Diary');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
application.CreateForm(TDiaryForm,DiaryForm);
diaryform.ShowModal;
diaryform.Free;
end;

Roy Lambert
RE: More teething problems with Addict4
Roy,

Shall get the Author to look at the issues raised in this thread - I would
say that I use Addict on Data Modules in all my own Applications and a
couple of the demos at http://www.addictivesoftware.com/other-downloads.htm
also do this without any problems - however he may have a better idea of
what is happening than I :)

BTW he forwarded me an updated WPTAddict to do some testing with - so we
hopefully will have an update there for you soon :)


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    






--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: More teething problems with Addict4
Thanks - if you want me to do some beta testing of the WPTAddict stuff I'm happy to do so.

Roy Lambert
RE: RE: More teething problems with Addict4
Thanks - if you want me to do some beta testing of the WPTAddict stuff I'm
happy to do so.

I've just uploaded the updated new WPTAddict -
http://www.addictivesoftware.com/bin/a4demos/a4wptaddict.zip - fixes the
problem I was able to see from your early post - so yes please give it a try
:)


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: More teething problems with Addict4
Glenn


I'm sure you haven't, but don't forget the parenting problem - that I can reproduce at will, and its more of a problem.

The range check error is a bit weird. Last night I could get it to go away after rebuilding the app - sometimes 3 or 4 rebuilds were necessary. Sometimes just pressing F9 was all that was needed others 1 or more rebuilds. It might have something to do with creation order, or,�thinking�about�it, it might be linked with the parenting problem.

Roy Lambert
Re: RE: RE: More teething problems with Addict4
Glenn


WPTAddict.
When its working it seems OK, however, I'm now, intermittently, getting the range check error when I click in the Options button on the dialog which makes it difficult to give it a real workout.

Another problem
I'm having another problem, and I think I might have spotted a cause of something. Right click on a misspelt word, if necessary click Spelling... click Ignore Once - the form's OnActivate event is fired!

Ditto for Ignore All or Change.

This is a potential nightmare. I can build in switches to prevent the code in FormActivate running more than once, but in at least one case I want it to run each time the page is clicked on (its the diary and I want it to go to the current date each time) but not when I do something with a spell check.

Roy Lambert
Re: RE: RE: More teething problems with Addict4
Glenn


Just been checking the FormActivate with V3 and its the same - might explain some of the fun I've been having with apps using it. I can understand why its happening, not sure what you can do about it. A flag of some sort would be useful so that I can check in FormActivate and exit if its found. Obviously I'd need to reset it.

There may even be one there already that I know nothing about.

Roy Lambert
RE: RE: More teething problems with Addict4
I'm sure you haven't, but don't forget the parenting problem - that I can
reproduce at will, and its more of a problem.

Still waiting to hear from the Author on that one :) - Glenn


-- Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
RE: RE: RE: More teething problems with Addict4
Just been checking the FormActivate with V3 and its the same - might
explain
some of the fun I've been having with apps using it. I can understand why
its
happening, not sure what you can do about it. A flag of some sort would be
useful so that I can check in FormActivate and exit if its found.
Obviously I'd
need to reset it.

I believe this behaviour is intentional with LiveSpell and the Spell Dialog
when the Dialog is in non-Modal form. I will need to check with the Author
to confirm.

I did some testing confirming the behaviour, but it didn't seem to be there
when I changed the DialogShowModal to true - but then of course you don't
have the back and forward interaction (not that I use that all that often).


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    






--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: RE: RE: More teething problems with Addict4
Glenn


Obviously you don't need much sleep <g>

I checked and the behaviour is the same as in V3 (explains a few problems I was having <g>) and its understandable after all you loose focus and regain focus. The surprising thing is that FormActivate is actually working when the form is parented on a pagecontrol. I'm having to send a user defined message to trigger a procedure which calls the formactivate event when I changes pages.

I'm playing with the menudemo from the Addict site to see if I can replace the dialog with a MustangPeak DropDownForm which doesn't have the same problem (I've used it as the basis of a glyph lookup and it works very well) but so far its a bit of a struggle.

Roy Lambert
RE: RE: RE: RE: More teething problems with Addict4
Obviously you don't need much sleep <g>

Only just gone Midnight in Western Australia ;-)

I checked and the behaviour is the same as in V3 (explains a few problems
I
was having <g>) and its understandable after all you loose focus and
regain
focus. The surprising thing is that FormActivate is actually working when
the
form is parented on a pagecontrol. I'm having to send a user defined
message
to trigger a procedure which calls the formactivate event when I changes
pages.
I'm playing with the menudemo from the Addict site to see if I can replace
the
dialog with a MustangPeak DropDownForm which doesn't have the same
problem (I've used it as the basis of a glyph lookup and it works very
well) but
so far its a bit of a struggle.

So does change the DialogShowModal Property to true not fix things - or does
having a Modal dialog cause other problems for you?


Glenn Crouch, mailto:glenn@esbconsult.com
ESB Consultancy, http://www.esbconsult.com
Home of ESBPCS, ESB Calculators, ESBStats and ESBPDF Analysis
Kalgoorlie-Boulder, Western Australia  





-- Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: RE: RE: RE: More teething problems with Addict4
Addict


So does change the DialogShowModal Property to true not fix things

Yes it does

- or does
having a Modal dialog cause other problems for you?

I'll find out <g>

At some point I still want to change the dialogs so its good practice anyway.

Roy Lambert
Re: RE: RE: More teething problems with Addict4
Glenn

No idea if it has any relevance at all but I think I'm getting the range check error most often after a crash in the IDE (eg I forgot to open a table and then try to read it).

Its as if something isn't being cleaned up properly in that event. Sudden wild idea - if I can create to order enable MadExcept and see if it tells you anything.


main thread ($57c):
00883bdc +6c TfR.exe����� ad4EditSubclass 1850� +4 TAddictEditSubclass.PaintControl
00882ab0 +30 TfR.exe����� ad4EditSubclass 1022 +10 TAddictEditSubclass.WMPaint
008822e4 +d0 TfR.exe����� ad4EditSubclass� 726 +38 TAddictEditSubclass.SubclassWndProc
0047ab88 +14 TfR.exe����� Classes����������������� StdWndProc
76f699cb +2b ntdll.dll���������������������������� KiUserCallbackDispatcher
76ba5a27 +0a USER32.dll��������������������������� DispatchMessageA
004d6868 +fc TfR.exe����� Forms������������������� TApplication.ProcessMessage
004d68a2 +0a TfR.exe����� Forms������������������� TApplication.HandleMessage
004d6ac2 +96 TfR.exe����� Forms������������������� TApplication.Run
00b6238a +86 TfR.exe����� TfR������������� 113� +8 initialization
7659490f +10 kernel32.dll������������������������� BaseThreadInitThunk

modules:
00140000 borlndmm.dll������������ 4.74.0.167������ E:\HH Dev\TfRSource
00400000 TfR.exe���������������������������������� E:\HH Dev\TfRSource
022d0000 FastMM_FullDebugMode.dll 1.44.0.4�������� E:\HH Dev\TfRSource
6c1b0000 avgrsstx.dll������������ 8.0.0.223������� C:\Windows\system32
6f710000 RICHED20.dll������������ 5.31.23.1228���� C:\Windows\system32
705b0000 RICHED32.DLL������������ 6.0.6001.18000�� C:\Windows\system32
70600000 olepro32.dll������������ 6.0.6001.18000�� C:\Windows\system32
723b0000 winspool.drv������������ 6.0.6001.18000�� C:\Windows\system32
73230000 wsock32.dll������������� 6.0.6001.18000�� C:\Windows\system32
734a0000 comctl32.dll������������ 5.82.6001.18000� C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6001.18000_none_886786f450a74a05
73ca0000 OLEACC.dll�������������� 4.2.5406.0������ C:\Windows\system32
73ce0000 winmm.dll��������������� 6.0.6001.18000�� C:\Windows\system32
740a0000 gdiplus.dll������������� 5.2.6001.18065�� C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6001.18065_none_9e7abe2ec9c13222
74400000 uxtheme.dll������������� 6.0.6001.18000�� C:\Windows\system32
74440000 comctl32.dll������������ 6.10.6001.18000� C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc
749e0000 msimg32.dll������������� 6.0.6000.16386�� C:\Windows\system32
74db0000 version.dll������������� 6.0.6001.18000�� C:\Windows\system32
74f00000 dhcpcsvc6.DLL����������� 6.0.6001.18000�� C:\Windows\system32
74f30000 WINNSI.DLL�������������� 6.0.6001.18000�� C:\Windows\system32
74f40000 dhcpcsvc.DLL������������ 6.0.6001.18000�� C:\Windows\system32
74f80000 iphlpapi.dll������������ 6.0.6001.18000�� C:\Windows\system32
751c0000 DNSAPI.dll�������������� 6.0.6001.18000�� C:\Windows\system32
75620000 Secur32.dll������������� 6.0.6001.18000�� C:\Windows\system32
75790000 msvcrt.dll�������������� 7.0.6001.18000�� C:\Windows\system32
75840000 MSCTF.dll��������������� 6.0.6001.18000�� C:\Windows\system32
75910000 shell32.dll������������� 6.0.6001.18062�� C:\Windows\system32
764f0000 SHLWAPI.dll������������� 6.0.6001.18000�� C:\Windows\system32
76550000 kernel32.dll������������ 6.0.6001.18000�� C:\Windows\system32
76630000 ole32.dll��������������� 6.0.6001.18000�� C:\Windows\system32
76780000 USP10.dll��������������� 1.626.6001.18000 C:\Windows\system32
76800000 oleaut32.dll������������ 6.0.6001.18000�� C:\Windows\system32
76890000 LPK.DLL����������������� 6.0.6001.18000�� C:\Windows\system32
76930000 ADVAPI32.dll������������ 6.0.6001.18000�� C:\Windows\system32
76b90000 USER32.dll�������������� 6.0.6001.18000�� C:\Windows\system32
76c40000 NSI.dll����������������� 6.0.6001.18000�� C:\Windows\system32
76d80000 imm32.dll��������������� 6.0.6001.18000�� C:\Windows\system32
76da0000 RPCRT4.dll�������������� 6.0.6001.18051�� C:\Windows\system32
76e70000 GDI32.dll��������������� 6.0.6001.18023�� C:\Windows\system32
76f10000 ntdll.dll��������������� 6.0.6001.18000�� C:\Windows\system32
77070000 comdlg32.dll������������ 6.0.6001.18000�� C:\Windows\system32
77140000 WS2_32.dll�������������� 6.0.6001.18000�� C:\Windows\system32




cpu registers:
eax = 04479950
ebx = 00883bdc
ecx = 04479950
edx = 00883bdc
esi = 00883bdc
edi = 00a70385
eip = 00883bdc
esp = 0012f324
ebp = 0012f40c

stack dump:
0012f324� dc 3b 88 00 de fa ed 0e - 01 00 00 00 07 00 00 00� .;..............
0012f334� 38 f3 12 00 dc 3b 88 00 - 50 99 47 04 dc 3b 88 00� 8....;..P.G..;..
0012f344� dc 3b 88 00 85 03 a7 00 - 0c f4 12 00 54 f3 12 00� .;..........T...
0012f354� 04 00 00 00 7c 2f 40 00 - a1 13 01 1c 88 b0 f8 06� ....|/@.........
0012f364� dc 3b 88 00 70 f4 12 00 - fc 4f 40 00 0c f4 12 00� .;..p....O@.....
0012f374� 0f 00 00 00 73 17 01 9f - 88 b0 f8 06 00 00 00 00� ....s...........
0012f384� 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00� ................
0012f394� 0f 00 00 00 00 00 00 00 - 00 00 00 00 0f 00 00 00� ................
0012f3a4� cd ab ba dc 00 00 00 00 - 04 f4 12 00 0f 00 00 00� ................
0012f3b4� 2c f4 12 00 e0 f3 12 00 - 20 9b bf 76 c8 10 83 05� ,..........v....
0012f3c4� 2c f4 12 00 e9 f7 ba 76 - ab f7 ba 76 f2 d9 d5 3f� ,......v...v...?
0012f3d4� 0f 00 00 00 bb 02 3d 00 - 00 00 00 00 00 00 00 00� ......=.........
0012f3e4� 79 01 00 00 14 00 00 00 - 00 00 00 00 70 00 00 00� y...........p...
0012f3f4� ff ff ff ff ff ff ff ff - e6 e6 b9 76 23 e7 b9 76� ...........v#..v
0012f404� d5 a0 ba 76 73 17 01 9f - b4 f4 12 00 b5 2a 88 00� ...vs........*..
0012f414� 73 17 01 9f 00 00 00 00 - 00 00 00 00 00 00 00 00� s...............
0012f424� 79 01 00 00 14 00 00 00 - 00 00 00 00 00 00 00 00� y...............
0012f434� e9 9b 27 96 00 00 00 00 - 00 00 00 00 79 01 00 00� ..'.........y...
0012f444� 14 00 00 00 5c 5c 9b c4 - 40 d8 89 fe 34 fd 23 8c� ....\\..@...4.#.
0012f454� 00 00 00 00 00 00 00 00 - 79 01 00 00 14 00 00 00� ........y.......

disassembling:
[...]
00883bcd������� push��� eax
00883bce������� call��� -$47a3bb ($409818)���� ; Windows.SendMessage
00883bd3������� test��� eax, eax
00883bd5������� jns���� loc_883bdc
00883bd7������� call��� -$47f564 ($404678)���� ; System.@BoundErr
00883bdc����� > push��� eax
00883bdd������� push��� esi
00883bde������� call��� -$47aacb ($409118)���� ; Windows.SelectObject
00883be3������� mov���� [ebp-$18], eax
00883be6 1851�� lea���� eax, [ebp-$68]
00883be9������� push��� eax
[...]
RE: RE: RE: More teething problems with Addict4
Its as if something isn't being cleaned up properly in that event. Sudden
wild
idea - if I can create to order enable MadExcept and see if it tells you
anything.

Shall see what the Author thinks - thanks!


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
RE: RE: RE: More teething problems with Addict4
Roy,

In regards to the Form Activate issue, the Author notes as follows:

The definition of OnActivate is that it's called when the form receives
input focus.  When you launch another form and go back and forth between
them this will fire as the form will lose and regain input focus.

This is just the natural behavior of Windows (and in turn Delphi) when
dealing with multiple windows.
---
As noted the Modal Dialog property is the way around this :)


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
RE: RE: RE: More teething problems with Addict4
From the Addict Author:

I can see from the Disassembly below that Roy's running with Range Checking
and Delphi is adding a check that the HGDIOBJ passed into SelectObject is
not NULL.

   OldFont         := SelectObject( MemDC, SendMessage( FHandle,
WM_GETFONT, 0, 0 ) );

What that means is that the edit control is not returning a font handle in
response to WM_GETFONT.  I haven't seen this before - it's cause is likely
external.

Realistically, however, this check is really only marginally valid.  It is
possible to do resource exchanges with NULL -- which is what would have
happened.

I can fix this up though to not throw the range checking exception... will
provide a fix to you shortly.


-- Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: RE: RE: More teething problems with Addict4
Glenn

This is just the natural behavior of Windows (and in turn Delphi) when
dealing with multiple windows.

As I thought - no problem

As noted the Modal Dialog property is the way around this :)

And it does - thanks.

Roy Lambert
Re: RE: RE: RE: More teething problems with Addict4
Glenn

I can see from the Disassembly below that Roy's running with Range Checking
and Delphi is adding a check that the HGDIOBJ passed into SelectObject is
not NULL.

OK so I'll turn range checking back off <g>

Roy Lambert

Page 1 of 2 Next >