Page 2 of 3
Posted: Wed Jun 11, 2003 4:31 pm
by talun
Hi El_Choni,
can you say me if it's possible to display the vertical scrollbar in the EditorGadget? (I wasn't able to find this style in the Win Api guide)
many thanks
Sergio
Posted: Wed Jun 11, 2003 7:00 pm
by El_Choni
The vertical scrollbar appears when the cursor reaches the bottom of the gadget.
Posted: Thu Jun 12, 2003 9:54 am
by talun
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
Posted: Thu Jun 12, 2003 2:25 pm
by Thorsten
Right - I had this problem too
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)
Now the scrollbars always showed - and your problem is solved

Posted: Thu Jun 12, 2003 3:37 pm
by talun
Thorsten many thanks for your reply; now my window have the scrollbar!
The #EM_SHOWSCROLLBAR isn't reported in my (old) Win32Api help file; I need to be accustomed with the MSDN Microsoft site.. 8O
bye
Sergio
Posted: Wed Jun 18, 2003 2:22 pm
by dige
@El_Choni:
I dont wana use callbacks to detect url-clicks ( #EM_LINK ) at editor
gadgets. Is there another way to get the #EM_LINK message?
Unfortunately it seems that WaitWindowEvent() doesnt realize that message ...
cya dige
Posted: Wed Jun 18, 2003 2:45 pm
by El_Choni
I don't know other way. Messages are sent to the Window callback procedure. You can write an userlib to handle this, but I don't see it necessary. Is there any special reason why you don't want to use the callback?
Posted: Wed Jun 18, 2003 4:44 pm
by dige
The reason is that I lose all the standard features like copy, paste and select all. If I use windowcallbacks I have to code this features by myself.
Or is there a possibility to hook the eventhandling and not to replacing?
cya dige
Posted: Wed Jun 18, 2003 4:52 pm
by El_Choni
The reason is that I lose all the standard features like copy, paste and select all. If I use windowcallbacks I have to code this features by myself.
That shouldn't happen at all. Can you post some code where you have this problem?
Posted: Wed Jun 18, 2003 5:28 pm
by dige
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
Posted: Wed Jun 18, 2003 6:18 pm
by El_Choni
Would it not be better to use strings than memory allocations?
I don't know if it's better or faster, AFAIK it's just your choice.
What is the reason for : ProcedureReturn #PB_ProcessPureBasicEvents
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.
It is possible to expand the autourldedection for own ids?
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.
Load binary
Posted: Wed Jun 18, 2003 9:29 pm
by Andy
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. ...
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...
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
What's going wrong? Could anybody help me?
Andy
Posted: Thu Jun 19, 2003 12:47 am
by El_Choni
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
Posted: Thu Jun 19, 2003 1:03 am
by Andy
Yes, that it is! Your are great! Thank you very much.
Andy
Posted: Thu Jun 19, 2003 1:12 am
by El_Choni
No, it wasn't

, pick the new source (I've just updated it).