View Full Version : Rich Text Box Controls
hi there,
i have a problem with RTF... so i hope somebody can help me with it
i now developing a messenger client using vb (6.0). i used to using RTF control as my ChatHistory... till i ecountered a problem sending text style properties (bold, italic, underline, font name n font size) to the server.
Sending TextRTF format to server can solve the problem but not very efficient way coz... TextRTF will add a lots of garbage (the textRTF format) in front of my message... this coz heavy data transfer when many user online....
to solve the problem im now using DHTML edit control.. the data more smaller than TextRTF format.... but using this control have one critical error 'Automation error'..coz by DOM access failure which could terminate my program.
can i make the RTF interpret escape sequence (ASCII color) ??? or do you have any idea so i can use the RTF control in my program ???
thanx for ur time ... im looking forward ur reply.
bye..
Tukang_Paip
17-04-02, 12:54 AM
Posting Asal oleh hiorie
hi there,
i have a problem with RTF... so i hope somebody can help me with it
i now developing a messenger client using vb (6.0). i used to using RTF control as my ChatHistory... till i ecountered a problem sending text style properties (bold, italic, underline, font name n font size) to the server.
Sending TextRTF format to server can solve the problem but not very efficient way coz... TextRTF will add a lots of garbage (the textRTF format) in front of my message... this coz heavy data transfer when many user online....
to solve the problem im now using DHTML edit control.. the data more smaller than TextRTF format.... but using this control have one critical error 'Automation error'..coz by DOM access failure which could terminate my program.
can i make the RTF interpret escape sequence (ASCII color) ??? or do you have any idea so i can use the RTF control in my program ???
thanx for ur time ... im looking forward ur reply.
bye..
sori aaa aku tak reti speaking.. ape kata u buat kod utk setiap colour, style dan nama utk font tersebut. jadi takyah le nak anto textRTF format tuh. camni le la lebih kurang.. side aku anto teks dengan font Verdana, size 10pt, colour biru, normal..
ko bleh limitkan kod mcm..
utk nama font :
-----------------
arial - N000
Serif - N001
...
Verdana - N037
utk warna :
------------------
aku rase bleh guna format HTML color seperti #FFFFFF dsbnya..
untuk style font :
------------------------
normal - S000
underline - S001
superscript - S0002
dan sebagainya..
untuk size font:
----------------------
emm..letak je la size, tak pun letak 10PT utk font bersaiz 10 point.
10PX utk 10 pixels dan sebagainya..
so aku anto teks camnila jadinya :
N000$#FFFFFF$S000$10PT$Assalamualaikum..<cr><lf>
maka program yg terima tu interpret data yg kena sent tu dengan $ sebagai delimiter, dan <cr><lf> sebagai tanda data berakhir.
cuma idea je..kalau aku salah faham harap dimaafkan :)
mekasih org england :)... tak reti speaking konon.. :P
mekasih posting tu bang man... tapi itu la currently messenger (dengan RTB control) saye boleh buat. kalo saye buat cam bang man kate tu... memang boley ......... tapi.... itu akan effect nyer untuk seluruh baris..... camaner kalo user just mahu 'selected text' or 'selected char' yang ditukar ... tu yg saye pening ni........ kalo pakai DHTML semer tu settle.
saye pernah buat script sendiri... utk selesaikan masalah tu....... tapi berhenti tengah jln... sebab kompleks sangat... sampai saye boleh lost mase tengah pk..... urrggghhhh....
cam care saye buat ... saye simpan data dlm hidden RTB box lah..... tapi takleh gak.... banyak sangat value kena simpan.... kalo user buat 'selected text/char' yg banyak...
tu yg tanye ni.. takut takut ader lagi care yg simple... 'why take the long cut if there is safe n easy short cut ' ......
bang man ader idea ????
thanx for the reply.. ingat takde org jawab dah..
ok bye
yg speaking tu bukan aper... sebab saye post jugak utk forum vb mat salleh punyer... so malas nak translate ke melayu balik.. just copy n paste jer...
Tukang_Paip
17-04-02, 05:11 PM
err..u silap org le..aku baru je masuk forum nih..
Nape nak buat kompleks sgt.. skrg ni u punye messenger dah siap blum? maksud saya coding mengenai send/receive.. dah sempurna ke? dun worry about the text style.. u buat slow2.. jgn buang coding yg lama (kompleks tuh).. next time kalau u bace balik maybe u ade idea lagi canggih..saya takleh nak tolong dalam code pasal tak buat dlm VB. Delphi bleh la kot.
:cipan: sori la.... memang aku silap org... uhuxs.. :) semalam aku tengok nick ko cam tukangtaip sekali tukang_paip daaaa... :D ... silap tukang daa...
pasal soalan ko tu... hmmm... skang ni hanya satu jer masalah aku.... pasal text properties tu laa... pasal comunicate tu semer dah settle ... dah boley chat one to one n one to many.. boley kate .... 95% dah siap..... cume... skang dok carik jalan nak solve problem ni... dan dok testing system dan betolkan bugs yg ader......
nampaknyer... kena amik long way jugak la ni... :confused: .. tapi ape ape pom thanx for the reply dude...
n.
bukan nak buat kompleks tapi itu user requirement.
belatuk
18-04-02, 02:46 PM
tak boleh ke kalau gunakan html tag "<</a>font>" kat dlm msg tuh.. then kat receiver end tukar la balik..
just an idea.. :R
nampak nyer cam tu la belatuk...... its gonna be a long long day...... O:O ....
a'kum,
korang tau tak ??? camaner nak komen kat dalam VB selain guna... single quote ' ..... letih la kalo nak komen code yg banyak... ishhhhh
izafarid
26-04-02, 10:01 AM
View->Toolbar->Edit
Nampak tak icon garis-garis warna biru terang? Highlightkan code yang nak dicommentkan, kemudian click kat pada tersebut. Untuk uncomment click pada icon disebelahnya.
a'kum,
kat sini saye sertakn simulation app. bagi masalah diatas.
separuh masalah dah boleh settle... tapi ader separuh lagi yg saye dah tak idea nak buat camaner...
berikut merupakan data app:
The controls of the Professional and Enterprise Editions
-> apabila user boldkan 'Professional and Enterprise'
-> text di rtbHidden akan hasilkan protocol seperti berikut :
The controls of the [Verdana|10|0|1|0|0|Professional and Enterprise] Editions
hasilkan : The controls of the Professional and Enterprise Editions
dengan '[' sebagai start protocol , ']' end protocol dan '|' seperator protocol
[nama font|saiz font|color font|bold flag|italic flag|underline flag|user msg]
masalah timbul jika user nak buat perubahan atas sebahagian text yg dah boldkan tadi ('Professional and Enterprise').
contohnyer : 'Professional and Enterprise'
tindakan ini akan menghasilkan protocol dlm protocol seperti berikut:
The controls of the [Verdana|10|0|1|0|0|Professional [Verdana|10|0|1|1|0|and Enterprise]] Editions
-> protocol ini hasilkan output yg salah seperti berikut :
The controls of the Professional [Verdana Editions
skang protocol dah ader 2 '[' dan 2 ']' ... camaner nak intepret... takkan nak check kiri kanan carik '[' dan ']' wasernyer tak bagus la camgitu....
saper tau cara yg lebih baik.. pls make a posting
-----------------------------------------------------------------------------------
the simulation app
-----------------------------------------------------------------------------------
http://ihsan.com/shukri/chathistory.zip
-----------------------------------------------------------------------------------
thanx u
izafarid
29-04-02, 01:59 PM
Satu soalan,
seandainya user taip [ dan ] tidakkah akan membawa masalah untuk identify yang mana protokol dan yang mana message?
cth: [[[[[[[[][][][]]]]]]]]]]]]]]]][][][][][]]]]]]]]]]]]]
cadangan: cuba gunakan 2 hidden character untuk menggantikan protokol tersebut
Berkenaan masalah saudara,
cuba gunakan teknik pop/stack. (Dari kiri ke kanan juga).
Saya tak nampak ada cara lain untuk:
1. mengenalpasti bilangan protokol yang ada.
2. mengesan permulaan dan penamat setiap protokol yang ada.
p/s: strFind: Boleh membantu memudahkan proses pengesanan.
mekacih atas posting tu...
camaner kalo user input begini :
anak harimau, mak harimau dan bapak harimau
kat situ ader 3 perkataan harimau... strfind akan get the fisrt occurrence harimau walaupun yg user select adalah yg ketiga.
camaner kiter nak tau user select harimau yg ketiga.. so dekat rtbhidden pom harimau yg ketiga di select bukan harimau pertama.
izafarid
29-04-02, 04:55 PM
strFind seperti yang saya cadangkan digunakan untuk mengesan kedudukan protokol. Gambaran awal saya untuk proses tersebut ianya agak mencabar.
Untuk masalah baru ini (baru dipost), Saya rasa hanya penggunaan API yang dapat membantu.
1. User akan highlight text
2. User akan cuba ubah property text tersebut (font type, size, colour)
3. Sebelum raise event tersebut, kedudukan highlight tersebut perlu dikenalpasti, (length & start location)
4. Selepas event, ubah rtbHidden kepada nilai yang bersesuaian
Untuk langkah 3, saya rasa prosesnya tidak sukar. Bagi langkah 4 pula mungkin akan berhadapan dengan sedikit kesulitan.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.