Hi Leutz,
ich versuche schon seit längerem smilies in ein editorgadget() einzufügen, ich hab jetzt endlich ne möglichkeit gefunden
http://www.purebasic.fr/english/viewtop ... e+gadgetid
aber Ich habe jetzt das problem das ich nicht weiß wie ich z.b. das ":D" durch das smilie ersetzen kann, weil es geht iwie nur wenn man nur das bild einfügt. hab es mit replacestring(text,":D",smilie$) versucht aba das geht leider nicht, bitte kann jemand helfen.
Smilie in Editorgadget() [Gelöst]
Smilie in Editorgadget() [Gelöst]
Zuletzt geändert von Gast am 22.02.2007 09:58, insgesamt 1-mal geändert.
hab das problem gelöst.
damit andere leute auch eine antwort auf das problem haben, hier die antwort:
hab ich jetzt so halb aus dem kopf heraus geschrieben, deshalb bin ich mir nicht sicher das es funktioniert, denke aber mal schon.
wenn fehler drin sind, einfach verbessern
mfg Maikel
damit andere leute auch eine antwort auf das problem haben, hier die antwort:
Code: Alles auswählen
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
EditorGadget(1, 8, 8, 306, 133)
RichEdit_SetInterface(GadgetID(1))
Beginn$="{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}"
Beginn$+"\viewkind4\uc1\pard\f0\fs20{\pict\wmetafile8\picw397\pich397\picwgoal225\pichgoal225 "
a$+"010009000003f500000002007e0000000000050000000b0200000000050000000c028d018d0125"
a$+"000000f70000031000ffea00004545450000000000ffce0000ffc90000fe9d0000ffb40000fffe"
a$+"9300fffd1300ffffc700ffe50000ffffeb00000000000000000000000000000000000400000034"
a$+"0200000300000035007e000000430f2000cc0000000f000f00000000008d018d01000000002800"
a$+"00000f0000000f000000010004000000000078000000c40e0000c40e0000100000000000000000"
a$+"eaff00454545000000000000ceff0000c9ff00009dfe0000b4ff0093feff0013fdff00c7ffff00"
a$+"00e5ff00ebffff0000000000000000000000000000000000ccccc11111ccccc0ccc116666511cc"
a$+"c0cc13344444351cc0c13320000a2351c0c1300222220431c013000000000a4510180000000000"
a$+"4610170000000000461017800200020046101980020002004510c1720000000231c0c197200000"
a$+"2351c0cc1b988000351cc0ccc11b977311ccc0ccccc11111ccccc02d000000f700000314000000"
a$+"0000800000000080000080800000000080008000800000808000c0c0c000c0dcc000a6caf000ff"
a$+"fbf000a0a0a40080808000ff00000000ff0000ffff00000000ff00ff00ff0000ffff00ffffff00"
a$+"040000003402010004000000f0010000030000000000"
AddGadgetItem(1,-1,Beginn$ +" Text" + a$ + " Text")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
wenn fehler drin sind, einfach verbessern

mfg Maikel
Zuletzt geändert von Gast am 22.02.2007 15:55, insgesamt 1-mal geändert.
>>RichEdit_SetInterface() Is not a function, array, macro or linked list
Is das aus ner Userlib, oder was soll das sein?
EDIT: Man sollte schon das Includefile dazu nehmen. Funkioniert aber trotzdem nicht.
AddGadgetItem() geht schonmal nicht bei nem Editorgadget, aber SetGadgetText() funzt auch nicht.
Is das aus ner Userlib, oder was soll das sein?
EDIT: Man sollte schon das Includefile dazu nehmen. Funkioniert aber trotzdem nicht.
AddGadgetItem() geht schonmal nicht bei nem Editorgadget, aber SetGadgetText() funzt auch nicht.
die include file oder der dazugehörige code, steht oben im link,
und addgadgetitem(1,-1,Beginn$+" "+a$) funzt, ich hab es doch bei mir gemacht mit einem editorgadget.
hier ist als beispiel mal der gesagte code, mit der include aus den link von oben.
und addgadgetitem(1,-1,Beginn$+" "+a$) funzt, ich hab es doch bei mir gemacht mit einem editorgadget.
hier ist als beispiel mal der gesagte code, mit der include aus den link von oben.
Code: Alles auswählen
#STGM_SHARE_EXCLUSIVE=$00000010
#STGM_READWRITE = $00000002
#STGM_CREATE = $00001000
Declare.l StreamDataCallback(dwCookie, pbBuff, cb, pcb)
Declare.l StreamFileInCallback(dwCookie, pbBuff, cb, pcb)
Declare.l StreamFileOutCallback(dwCookie, pbBuff, cb, pcb)
Structure RichEditOle
*pIntf.l
Refcount.l
EndStructure
Global NewList RichComObject.RichEditOle()
Global prtf
Procedure.l CatchRTF(Gadget, datastart, dataend, replaceall=0)
Protected edstr.EDITSTREAM
prtf = datastart
edstr\dwCookie = dataend
edstr\dwError = 0
edstr\pfnCallback = @StreamDataCallback()
SendMessage_(GadgetID(Gadget), #EM_STREAMIN, #SF_RTF|replaceall, edstr)
ProcedureReturn edstr\dwError
EndProcedure
Procedure.l StreamDataCallback(dwCookie, pbBuff, cb, pcb)
Protected result
result = 0
If prtf>=dwCookie
cb = 0
result = 1
ElseIf prtf+cb>=dwCookie
cb = dwCookie-prtf
EndIf
CopyMemory(prtf, pbBuff, cb)
prtf+cb
PokeL(pcb, cb)
ProcedureReturn result
EndProcedure
Procedure.l LoadRTF(Gadget, filename.s, replaceall=0)
Protected edstr.EDITSTREAM
edstr\dwCookie = ReadFile(#PB_Any, filename)
If edstr\dwCookie
edstr\dwError = 0
edstr\pfnCallback = @StreamFileInCallback()
SendMessage_(GadgetID(Gadget), #EM_STREAMIN, #SF_RTF|replaceall, edstr)
CloseFile(edstr\dwCookie)
ProcedureReturn edstr\dwError
Else
ProcedureReturn 1
EndIf
EndProcedure
Procedure.l StreamFileInCallback(dwCookie, pbBuff, cb, pcb)
Protected result, length
result=0
length=ReadData(dwCookie, pbBuff, cb)
PokeL(pcb, length)
If length = 0
result = 1
EndIf
ProcedureReturn result
EndProcedure
Procedure.l SaveRTF(Gadget, filename.s)
Protected edstr.EDITSTREAM
edstr\dwCookie = CreateFile(#PB_Any, filename)
If edstr\dwCookie
edstr\dwError = 0
edstr\pfnCallback = @StreamFileOutCallback()
SendMessage_(GadgetID(Gadget), #EM_STREAMOUT, #SF_RTF, edstr)
CloseFile(edstr\dwCookie)
ProcedureReturn edstr\dwError
Else
ProcedureReturn 1
EndIf
EndProcedure
Procedure.l StreamFileOutCallback(dwCookie, pbBuff, cb, pcb)
Protected result, length
result=0
WriteData(dwCookie, pbBuff, cb)
PokeL(pcb, cb)
If cb = 0
result = 1
EndIf
ProcedureReturn result
EndProcedure
Procedure.l RichEdit_SetInterface(hwnd)
; If RichComObject\Refcount=0
AddElement(RichComObject())
RichComObject()\pIntf = ?VTable
SendMessage_(hwnd, #EM_SETOLECALLBACK, 0, RichComObject())
; EndIf
EndProcedure
Procedure.l RichEdit_QueryInterface(*pObject, REFIID, ppvObj)
ProcedureReturn #S_OK
EndProcedure
Procedure.l RichEdit_AddRef(*pObject.RichEditOle)
*pObject\Refcount+1
ProcedureReturn *pObject\Refcount
EndProcedure
Procedure.l RichEdit_Release(*pObject.RichEditOle)
*pObject\Refcount-1
If *pObject\Refcount > 0
ProcedureReturn *pObject\Refcount
Else
;Remove entry in the linked list.
ForEach RichComObject()
If RichComObject()=*pObject
DeleteElement(RichComObject()) : Break
EndIf
Next
*pObject=0
EndIf
EndProcedure
Procedure.l RichEdit_GetInPlaceContext(*pObject.RichEditOle, lplpFrame, lplpDoc, lpFrameInfo)
Debug 1
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_ShowContainerUI(*pObject.RichEditOle, fShow)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_QueryInsertObject(*pObject.RichEditOle, lpclsid, lpstg, cp)
ProcedureReturn #S_OK
EndProcedure
Procedure.l RichEdit_DeleteObject(*pObject.RichEditOle, lpoleobj)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_QueryAcceptData(*pObject.RichEditOle, lpdataobj, lpcfFormat, reco, fReally, hMetaPict)
ProcedureReturn #S_OK
EndProcedure
Procedure.l RichEdit_ContextSensitiveHelp(*pObject.RichEditOle, fEnterMode)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_GetClipboardData(*pObject.RichEditOle, lpchrg, reco, lplpdataobj)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_GetDragDropEffect(*pObject.RichEditOle, fDrag, grfKeyState, pdwEffect)
;PokeL(pdwEffect,0) ;Uncomment this to prevent dropping to the editor gadget.
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_GetContextMenu(*pObject.RichEditOle, seltype.w, lpoleobj, lpchrg, lphmenu)
ProcedureReturn #E_NOTIMPL
EndProcedure
Procedure.l RichEdit_GetNewStorage(*pObject.RichEditOle, lplpstg)
Protected sc, lpLockBytes, t.ILockBytes
;Attempt to create a byte array object which acts as the 'foundation' for the upcoming compound file.
sc=CreateILockBytesOnHGlobal_(#Null, #True, @lpLockBytes)
If sc ;This means that the allocation failed.
ProcedureReturn sc
EndIf
;Allocation succeeded so we now attempt to create a compound file storage object.
sc=StgCreateDocfileOnILockBytes_(lpLockBytes, #STGM_SHARE_EXCLUSIVE|#STGM_READWRITE|#STGM_CREATE, 0, lplpstg)
If sc ;This means that the allocation failed.
t = lpLockBytes
t\Release()
ProcedureReturn sc
EndIf
EndProcedure
DataSection
VTable:
Data.l @RichEdit_QueryInterface(), @RichEdit_AddRef(), @RichEdit_Release(), @RichEdit_GetNewStorage()
Data.l @RichEdit_GetInPlaceContext(), @RichEdit_ShowContainerUI(), @RichEdit_QueryInsertObject()
Data.l @RichEdit_DeleteObject(), @RichEdit_QueryAcceptData(), @RichEdit_ContextSensitiveHelp(), @RichEdit_GetClipboardData()
Data.l @RichEdit_GetDragDropEffect(), @RichEdit_GetContextMenu()
EndDataSection
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
EditorGadget(1, 8, 8, 306, 133)
RichEdit_SetInterface(GadgetID(1))
Beginn$ = "{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fswiss\fcharset0 Arial;}}"
Beginn$+"{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20"
a$="{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1031\deflangfe1031{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}"
a$+"{\f37\fscript\fcharset0\fprq2{\*\panose 030f0702030302020204}Comic Sans MS;}{\f38\froman\fcharset238\fprq2 Times New Roman CE;}{\f39\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f41\froman\fcharset161\fprq2 Times New Roman Greek;}"
a$+"{\f42\froman\fcharset162\fprq2 Times New Roman Tur;}{\f43\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f44\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f45\froman\fcharset186\fprq2 Times New Roman Baltic;}"
a$+"{\f46\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f48\fswiss\fcharset238\fprq2 Arial CE;}{\f49\fswiss\fcharset204\fprq2 Arial Cyr;}{\f51\fswiss\fcharset161\fprq2 Arial Greek;}{\f52\fswiss\fcharset162\fprq2 Arial Tur;}"
a$+"{\f53\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f54\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f55\fswiss\fcharset186\fprq2 Arial Baltic;}{\f56\fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f408\fscript\fcharset238\fprq2 Comic Sans MS CE;}"
a$+"{\f409\fscript\fcharset204\fprq2 Comic Sans MS Cyr;}{\f411\fscript\fcharset161\fprq2 Comic Sans MS Greek;}{\f412\fscript\fcharset162\fprq2 Comic Sans MS Tur;}{\f415\fscript\fcharset186\fprq2 Comic Sans MS Baltic;}}{\colortbl;\red0\green0\blue0;"
a$+"\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;"
a$+"\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 \snext0 Normal;}"
a$+"{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*"
a$+"\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv "
a$+"\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid10952123\rsid13717669}"
a$+"{\*\generator Microsoft Word 11.0.6568;}{\info{\author PC}{\operator PC}{\creatim\yr2007\mo2\dy21\hr22\min29}{\revtim\yr2007\mo2\dy21\hr22\min29}{\version2}{\edmins0}{\nofpages1}{\nofwords0}{\nofchars1}{\*\company PC}{\nofcharsws1}{\vern24579}}"
a$+"\margl1417\margr1417\margt1417\margb1134 \widowctrl\ftnbj\aenddoc\hyphhotz425\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3"
a$+"\jcompress\viewkind4\viewscale70\nolnhtadjtbl\rsidroot10952123 \fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3"
a$+"\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}"
a$+"{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain "
a$+"\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang1031\langfe1031\cgrid\langnp1031\langfenp1031 {\f37\fs18\cf6\insrsid13717669\charrsid9927967 {\*\shppict{\pict{\*\picprop\shplid1026{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}"
a$+"{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn fLayoutInCell}{\sv 1}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0"
a$+"\picw397\pich397\picwgoal225\pichgoal225\pngblip\bliptag-649369947{\*\blipuid d94b66a53c51506544c443c635303d30}89504e470d0a1a0a0000000d494844520000000f0000000f0802000000b4b4021d000000017352474200aece1ce9000000097048597300000ec400000ec40195"
a$+"2b0e1b0000004649444154285363602005304214ffffff1fbf2e4646904a26ac4a2172c800621c4835f160b0abc61544d8dd8d19269090202dbcb1841ed019a4b984d818c06330b14690a90e00e0321b04b5805c220000000049454e44ae426082}}{\nonshppict"
a$+"{\pict\picscalex96\picscaley96\piccropl0\piccropr0\piccropt0\piccropb0\picw397\pich397\picwgoal225\pichgoal225\wmetafile8\bliptag-649369947\blipupi96{\*\blipuid d94b66a53c51506544c443c635303d30}"
a$+"010009000003a200000000007d00000000000400000003010800050000000b0200000000050000000c0210001000030000001e0004000000070104007d000000"
a$+"410b2000cc000f000f00000000000f000f0000000000280000000f0000000f000000010004000000000000000000000000000000000000000000000000000000"
a$+"0000ffffff00fefefe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
a$+"00000000000000000000000000000000022000000000000000220000000000000022000000000022222222222000022222202222220002222222222222000222"
a$+"222022222200022222202222220002222220222222000222222022222200022222202222220000222222222220000000000000000000040000002701ffff030000000000}"
e=0
AddGadgetItem(1,e-1,Beginn$ +" Text" + a$ + " Text")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf