Page 1 of 1

pureDispHelper & nBit control crash on release object

Posted: Thu May 03, 2007 9:09 am
by Dare
Hi.

I am trying the demo version of the http://www.nbit.net.au HTML editor with pureDispHelper.

This crashes with "invalid memory access" on dhReleaseObject.

Code: Select all

dhToggleExceptions(#True)
OpenWindow(1, 0,0, 800,600, "Test")
CreateGadgetList(WindowID(1))
ContainerGadget(1,10,10,600,300)
CloseGadgetList()
;         oEd = dhCreateObject("rmpHTML.HTMLEd", WindowID(1)) ; Okay, but fills window
oEd = dhCreateObject("rmpHTML.HTMLEd", GadgetID(1))  ; Okay
Debug oEd
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
dhReleaseObject(oEd) ; Crash if windowID or gadgetID used in dhCreateObject
                     ; --  Invalid Memory Access --
                     ; Crashes on first internal IDE comment line following this line.
                     ; so assume it is this line
If I don't use the windowID or gadgetID in createobject, it fails to load.
If I do use either, it loads and is editable but crashes with "invalid memory access" on release.

Also:
No errors are reported but setting/getting properties fails (just doesn't happen). Eg:

Code: Select all

w.s="<div>abc</div>"
dhPutValue(oEd, ".DocumentHTML = %s", @w)
I am obviously missing some major point here.

Can anyone help?




Aside and on another note altogether. How do you pass a word (2 byte integer) value in dhPutValue? ("%w" is not recognised).

Posted: Thu May 03, 2007 3:21 pm
by LuckyLuke
Using the OCX_CreateGadget() function works fine.

Code: Select all

oEd = OCX_CreateGadget(2, 10, 10, 600, 300, "rmpHTML.HTMLEd")
Regards,

Posted: Thu May 03, 2007 3:26 pm
by Dare
Ah!

Thank you!


(With OCX/COM and PureBasic I feel like I am running along a narrow beam '000s of ks above the ground - with my eyes closed on a pitch black night)


EEEEeeeeeeeyyyYYAAAAaaaaaa.

Posted: Thu May 03, 2007 5:05 pm
by ts-soft
Or you should close your window before program end, see the examples,
always CloseWindow(0) before end :wink:

Posted: Thu May 03, 2007 11:33 pm
by Dare
Ah yes. That also fixes it.

My bad there. Thanks!



This works quite nicely now with the OCX_CreateGadget function.


I sometimes get a "invalid memory address" error in the waitwindowevent loop after editing table properties but I think that might be the control not releasing the table and contents and so PB is suddenly given an unknown gadget (the table). Guessing.

But we advance.

Thanks again.