Problem with catch events from EditorGadget() -->PB 3.7
El_Choni,
thank you for the reply, but I'm sorry, I've formulated my question badly.
I would like to use the wordwrap capabilities of the EditorGadget in order to show some help pages and therefore I've modified the gadget style in read only mode by using:
SendMessage_(GadgetID(#MyGadget), #EM_SETOPTIONS, #ECOOP_SET, #ECO_READONLY)
All works fine but with this setting the vertical scrollbar don't appear and this creates problems with longer documents of the page because you need scroll the page by using the cursor keys.
Can you say me if it's possible to enable the vertical scrollbar in readonly mode?
Thanks in advance
Sergio
thank you for the reply, but I'm sorry, I've formulated my question badly.
I would like to use the wordwrap capabilities of the EditorGadget in order to show some help pages and therefore I've modified the gadget style in read only mode by using:
SendMessage_(GadgetID(#MyGadget), #EM_SETOPTIONS, #ECOOP_SET, #ECO_READONLY)
All works fine but with this setting the vertical scrollbar don't appear and this creates problems with longer documents of the page because you need scroll the page by using the cursor keys.
Can you say me if it's possible to enable the vertical scrollbar in readonly mode?
Thanks in advance
Sergio
Right - I had this problem too
You can send this messages to the gadget:
Now the scrollbars always showed - and your problem is solved 

You can send this messages to the gadget:
Code: Select all
SendMessage_(GadgetID(#Number), #EM_SHOWSCROLLBAR, #SB_VERT, #True)
SendMessage_(GadgetID(#Number), #EM_SHOWSCROLLBAR, #SB_HORZ, #True)

El_Choni, you are right. It works now with my new procedure.
Unfortunately I forgot my old procedure where I determined this circumstance. So I cant replicate the problem...
What I still wanted to annotate :
(1.) Would it not be better to use strings than memory allocations?
For example:
glink_.s = Space ( 512 )
txt\lpstrText = <a href="mailto:@gl">@gl</a>ink_.s
instead of:
StringBuffer = AllocateMemory(0, 512)
txt\lpstrText = StringBuffer
So it cant be happen to allocate the same memorybank at the same time, right?
(2.) What is the reason for : ProcedureReturn #PB_ProcessPureBasicEvents
(3.) It is possible to expand the autourldedection for own ids?
cya dige
Unfortunately I forgot my old procedure where I determined this circumstance. So I cant replicate the problem...
What I still wanted to annotate :
(1.) Would it not be better to use strings than memory allocations?
For example:
glink_.s = Space ( 512 )
txt\lpstrText = <a href="mailto:@gl">@gl</a>ink_.s
instead of:
StringBuffer = AllocateMemory(0, 512)
txt\lpstrText = StringBuffer
So it cant be happen to allocate the same memorybank at the same time, right?
(2.) What is the reason for : ProcedureReturn #PB_ProcessPureBasicEvents
(3.) It is possible to expand the autourldedection for own ids?
cya dige
I don't know if it's better or faster, AFAIK it's just your choice.Would it not be better to use strings than memory allocations?
When you use SetWindowCallback(), you must ensure to return #PB_ProcessPureBasicEvents, unless you don't want a particular message to be processed further by the default PB window procedure or the default window procedure.What is the reason for : ProcedureReturn #PB_ProcessPureBasicEvents
You can convert any text in a clickable link by using CFE_LINK and sending an EM_SETCHARFORMAT message. But AFAIK, autourldetection will just detect common URLs.It is possible to expand the autourldedection for own ids?
El_Choni
Load binary
With the same algorithm, it should be possible to load an included binary from memory to the EditorGadget... So I have try to change it...El_Choni wrote:(Mo Jun 09, 2003 07:12)Code: Select all
Procedure StreamFileInCallback(hFile, pbBuff, cb, pcb) ProcedureReturn ReadFile_(hFile, pbBuff, cb, pcb, 0)!1 EndProcedure Procedure loadFile(pFilePath.s) If ReadFile(0, pFilePath) ... uFormat = #SF_RTF edstr.EDITSTREAM edstr\dwCookie = UseFile(0) edstr\dwError = 0 edstr\pfnCallback = @StreamFileInCallback() SendMessage_(GadgetID(0), #EM_STREAMIN, uFormat, edstr) CloseFile(0) EndIf EndProcedure ETC. ...

But I think, I don't understand exactly, how to use the pointers - I have try many ideas - but sadly with no success...
Look here some of my code:
Code: Select all
Global RTFPtr.l
Procedure StreamFileInCallback(dwCookie, pbBuff, cb, *pcb.l)
If ?RTFEnd-RTFPtr>cb
*pcb=cb
weiter=cb
Else
*pcb=?RTFEnd-RTFPtr
weiter=0
EndIf
CopyMemory(RTFPtr, pbBuff, *pcb)
RTFPtr+*pcb
ProcedureReturn weiter
EndProcedure
Procedure _PutRTF()
RTFPtr=?RTFStart
uFormat = #SF_RTF
edstr.EDITSTREAM
edstr\dwCookie = 0
edstr\dwError = 0
edstr\pfnCallback = @StreamFileInCallback()
SendMessage_(GadgetID(0), #EM_STREAMIN, uFormat, edstr)
EndProcedure
If OpenWindow(0, 200, 200, 400, 200, #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Memory Put")=0:End:EndIf
If CreateGadgetList(WindowID())=0:End:EndIf
EditorGadget(0, 0, 0, WindowWidth(), WindowHeight())
_PutRTF()
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
End
End
DataSection
RTFStart:
IncludeBinary "includes\hinweis.rtf"
RTFEnd:
EndDataSection
Andy
This may give you a hint:
Code: Select all
Global RTFPtr.l
Procedure StreamFileInCallback(dwCookie, pbBuff, cb, pcb)
result = 0
If RTFPtr>=?RTFEnd
cb = 0
result = 1
ElseIf RTFPtr+cb>=?RTFEnd
cb = ?RTFEnd-RTFPtr
EndIf
CopyMemory(RTFPtr, pbBuff, cb)
RTFPtr+cb
PokeL(pcb, cb)
ProcedureReturn result
EndProcedure
Procedure _PutRTF()
RTFPtr=?RTFStart
uFormat = #SF_RTF
edstr.EDITSTREAM
edstr\dwCookie = 0
edstr\dwError = 0
edstr\pfnCallback = @StreamFileInCallback()
SendMessage_(GadgetID(0), #EM_STREAMIN, uFormat, edstr)
EndProcedure
If OpenWindow(0, 200, 200, 400, 200, #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Memory Put")=0:End:EndIf
If CreateGadgetList(WindowID())=0:End:EndIf
EditorGadget(0, 0, 0, WindowWidth(), WindowHeight())
SendMessage_(GadgetID(0), #EM_LIMITTEXT, -1, 0)
_PutRTF()
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
End
End
DataSection
RTFStart:
IncludeBinary "includes\hinweis.rtf"
RTFEnd:
EndDataSection
Last edited by El_Choni on Thu Jun 19, 2003 1:10 am, edited 1 time in total.
El_Choni