Brick_top Posted January 10, 2012 Posted January 10, 2012 Hi I have a routine that stores several development notes in xrecord. I'm trying to display the text in those notes in some kind of dialog box. as of now I'm using this: : boxed_column { : paragraph { : text_part { label = "notes"; } } the dcl is created on the fly according to the notes that exist in the drawing. problem is some lines of text are too big and dcl says "Dialog too large to fit on screen" I might also want to put some buttons below the notes that will display slides with the command vslide thanks by the way... sorry for all the posts Quote
Brick_top Posted January 10, 2012 Author Posted January 10, 2012 I could divide the string in several ones until it fits the screen but I would like to know if there is a better way Quote
Lee Mac Posted January 10, 2012 Posted January 10, 2012 Use a list_box to display the notes, maybe using my String Wrap function to split the notes onto separate lines. This way, the content will scroll when exceeding the vertical height of the list_box tile. Quote
Brick_top Posted January 10, 2012 Author Posted January 10, 2012 thanks a lot again.. I'm going to look into it. Quote
irneb Posted January 10, 2012 Posted January 10, 2012 You could place them in an edit_box, then set the is_enabled property to false. That way you can get automatic text wrapping working. Alternatively you could use a text tile and then set its value with coded new-lines. E.g. : text { key = "txt"; height = 3; value = "My long line of text\nhas a second line"; } So in your lisp you'd need to break the text up into a specified maximum line length. You'd search for the space / tab just before the next position, then replace that character with a "\n". You could try this routine to accomplish such: ;;; ------------------------------------------------------------------------------------- ;;; Word-wrap a string to a maximum length per line ;;; ------------------------------------------------------------------------------------- (defun Text:WordWrap (str len / n c m l) (setq n 0 l 0) (while (<= (setq n (1+ n)) (strlen str)) (cond ((member (setq c (substr str n 1)) '("\t" " ")) (setq m n)) ((member c '("\n")) (setq l n)) ) (if (and (> (- n l) len) m) (setq str (strcat (substr str 1 (1- m)) "\n" (substr str (1+ m))) l m m nil ) ) ) str ) Quote
Brick_top Posted January 10, 2012 Author Posted January 10, 2012 thanks a lot for all the suggestions, I'll see what I can do Quote
Brick_top Posted January 10, 2012 Author Posted January 10, 2012 (edited) Hi there, I managed to divide the strings using Lee's Function "string wrap". Irneb I tried to use yours but the dcl file gave me an error. But now I get a "dialog to large to fit on screen" in the vertical limits. I'll try to look into making an edit_box. I'm sorry I'm a beginner. Here is the code I'm using to create the dcl (vl-file-delete "C:\\Users\\ricardo.gomes\\Desktop\\Lisp\\info_dcl.dcl") (setq fn "C:\\Users\\ricardo.gomes\\Desktop\\Lisp\\info_dcl.dcl") (setq fh (open fn "a")) (setq a (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 3 (car x)))(entget (namedobjdict)))) b (vl-remove-if-not '(lambda (x) (= "Nota" (substr x 1 4))) a) );setq (princ "\ninfo_dcl : dialog {" fh) ;dialog (princ "\n: boxed_column {" fh) ;boxed column (cond ((/= nil b) (setq num1 1) (repeat (length b) (setq titl (strcat "Nota" " " (itoa num1)) titlo (substr titl 1 (strlen titl)) nt1 (cdr (assoc 1 (dictsearch (namedobjdict) titl))) nt1a (substr nt1 (+ (strlen titlo) 4) (strlen nt1)) nt2 (cdr (assoc 2 (dictsearch (namedobjdict) titl))) nt3 (cdr (assoc 3 (dictsearch (namedobjdict) titl))) );setq ;text_part (if (> (strlen nt1) 100) (progn (setq nt1n (LM:StringWrap nt1 100)) (princ "\n: paragraph {" fh) ;paragrafo (mapcar '(lambda (x) (princ "\n: text_part {" fh) (princ (strcat "\nlabel = " (chr 290) x (chr 290) ";") fh) ;texto (princ "\n}" fh);fim text_part ) nt1n );mapcar (princ "\n}" fh);fim text_part );progn (progn (princ "\n: text_part {" fh) (princ (strcat "\nlabel = " (chr 290) nt1 (chr 290) ";") fh) (princ "\n}" fh);fim text_part );progn );if (princ) (setq num1 (+ 1 num1)) );repeat ;;;;;;;botões ; (princ (strcat "\nkey = " (chr 290)"accept"(chr 290) ";") fh) chr 290 caracter para aspas (princ "\nok_only;" fh); (princ "\n}" fh); (princ "\n}" fh); ) );cond (princ) (close fh) this code creates this dcl in the case of the drawing used info_dcl : dialog { : boxed_column { : paragraph { : text_part { label = "Nota 1 - 30/11/2011 16:22 - O Eng. João Nunes deu-me este ficheiro de um arranjo urbanistico do"; } : text_part { label = "largo do poço à entrada de juromenha para fazer uns perfis a mando do arq. Rui rodrigues."; } } : paragraph { : text_part { label = "Nota 2 - 14/12/2011 11:36 - Foram definidos os materiais e os equipamentos a partir do orçamento do"; } : text_part { label = "josé pedro."; } } : paragraph { : text_part { label = "Nota 3 - 19/12/2011 11:24 - Foi finalizada a primeira proposta, falta ainda definir o titulo do"; } : text_part { label = "projeto, esse nome vai-me ser dado pelo Sr. Pacheco."; } } : paragraph { : text_part { label = "Nota 4 - 20/12/2011 09:09 - Após conversa com o Sr. Pacheco e o Eng. João Nunes foi decidido fazer"; } : text_part { label = "uma nova proposta recuando a zona dos estacionamentos aproximadamente 70cm, esta alteração é devido"; } : text_part { label = "ao aumento da faixa de rodagem definido noutro projeto."; } } : paragraph { : text_part { label = "Nota 5 - 20/12/2011 14:25 - Foi terminada a proposta da nota anterior, foi também incluido o tubo"; } : text_part { label = "de esgotos no pormenor, criei um ficheiro com esta ultima alteração e meti na rede da Ana simão"; } : text_part { label = "para ela começar a fazer a memória descritiva."; } } : paragraph { : text_part { label = "Nota 6 - 21/12/2011 10:09 - O projeto foi revisto pelo sr. pacheco, foram feitas novas medições"; } : text_part { label = "para o joão piteira, foram adicionadas imagens das mesas e das vedações á legenda do desenho, o"; } : text_part { label = "lancil de betão deixo de ser com aresta viva."; } } : paragraph { : text_part { label = "Nota 7 - 21/12/2011 11:40 - Foi impressa uma cópia dos dois desenhos, foi também criada uma cópia"; } : text_part { label = "do ficheiro com o nome 6-7.dwg para enviar ao joão nunes, este ficheiro vai servir para ficar numa"; } : text_part { label = "pasta com o projeto completo. O ficheiro 6-7.dwg foi enviado ao joão nunes."; } } : paragraph { : text_part { label = "Nota 8 - 21/12/2011 13:33 - Foram mudadas as designações e dimensões das camadas da zona do"; } : text_part { label = "estacionamento, foi novamente gravado um ficheiro com o nome 6-7.dwg e enviado para o eng. joão"; } : text_part { label = "nunes."; } } : paragraph { : text_part { label = "Nota 9 - 21/12/2011 14:01 - Foram criados ficheiros dwf dos layouts, 6.dwf e 7.dwf enviados para o"; } : text_part { label = "eng. joão nunes."; } } : paragraph { : text_part { label = "Nota 10 - 22/12/2011 09:40 - Foi alterado o comprimento do lancil em betão de 1.2m para 1.0m no"; } : text_part { label = "desenho do pormenor, foi impressa uma cópia do layout e foi criado o ficheiro 6-7.dwg e o ficheiro"; } : text_part { label = "7.dwf para enviar ao eng. João Nunes."; } } : paragraph { : text_part { label = "Nota 11 - 22/12/2011 10:31 - Foi alterado o grafismo do xisto a cutelo, foi alterada também a"; } : text_part { label = "designação da legenda em planta de xisto em cutelo para xisto a cutelo, foi impressa uma cópia"; } : text_part { label = "somente do pormenor, foi gravado novamente o ficheiro 6-7.dwg e o 6.dwf e 7.dwf para enviar ao eng."; } : text_part { label = "João Nunes."; } } : text_part { label = "Nota 12 - 26/12/2011 14:31 - Foi impressa uma cópia para a maria do carmo."; } ok_only; } } Edited January 10, 2012 by Brick_top Quote
irneb Posted January 10, 2012 Posted January 10, 2012 Well seeing as your text is so large I think your best bet would be to use and edit_box instead. That way you'd get a scroll bar for text spanning much more than the screen could show. The reason you get a too large dialog is that you're setting the label which then determines the text tile's width/height from the label. I would set the height to a specified number of lines and the width to the required line length. Then I'd set the Value instead of the label - thus text not fitting into the allowed space would simply not display. Quote
Brick_top Posted January 10, 2012 Author Posted January 10, 2012 I can only answer tomorrow, I have to go now thanks a lot Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 thanks for your tips irneb, I'll search how to do that. Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 irneb could you help me with the syntax of the dcl part of the edit_box? Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 Here is what I'm doing... I guess it is really bad. info_dcl : dialog {label = "Histórico do ficheiro - AQ_Electricidade Salgueiro 17-10-2011.dwg"; : boxed_column { : edit_box { is_enabled = false; value = "Nota 1 - 26/10/2011 10:34 - Foi feito um traçado de telefones para o Eng. Salgueiro, Foi impresso"; value = "um esboço num A4."; value = "Nota 2 - 02/11/2011 09:47 - Foram criadas legendas dos desenhos e inseridas folhas nos layouts para"; value = "o Eng. Salgueiro"; value = "Nota 3 - 21/11/2011 10:09 - Foram impressas 3 cópias de cada desenho para o Eng. Salgueiro."; value = "Nota 4 - 25/11/2011 10:32 - Foi enviado por email para joaquimrosa.rosado@edp.pt este ficheiro"; value = "somente com o projecto BT a pedido do Eng. Salgueiro."; value = "Nota 5 - 25/11/2011 10:33 - Contém um projecto de um ramal de alimentação do complexo desportivo de"; value = "alandroal, infraestruturas telefónicas e rede BT, feito a pedido do Eng. Salgueiro."; value = "Nota 6 - 25/11/2011 10:50 - Foi impressa uma cópia em a4 da rede de BT do complexo desportivo para"; value = "o Eng. Salgueiro."; value = "Nota 7 - 30/11/2011 14:16 - foi impressa uma cópia da rede de BT do complexo desportivo para o Eng."; value = "Salgueiro."; value = "Nota 8 - 07/12/2011 09:01 - Foi impressa uma cópia do layout dos telefones do complexo desportivo"; value = "para a eng. Ana Simão."; value = "Nota 9 - 27/12/2011 14:30 - Foi feita uma planta com uma nova proposta do projeto de telefones do"; value = "complexo desportivo campo de futebol de alandroal, esta proposta foi pedida pelo Sr. Pacheco, a"; value = "proposta anterior era do eng. Salgueiro. Nesta proposta foi abolida uma travessia e o traçado foi"; value = "mudado para o lado oposto da proposta anterior, foi criado um pdf do layout da mesma Telefones pdf"; value = "27-12 e enviado ao Sr. Pacheco."; value = "Nota 10 - 27/12/2011 15:55 - Foi feita a medição do cabo lsvav 4x35 do desenho de BT para o Sr."; value = "Pacheco."; value = "Nota 11 - 29/12/2011 09:44 - Foi impresso um A4 somente da zona do traçado BT para o sr. pacheco,"; value = "foi também criado um pdf do layout BT também para o Sr. Pacheco, foram também adicionados"; value = "descritivos dos cabos da ultima alteração aos telefones, esta alteração ainda não foi impressa, o"; value = "sr. pacheco foi perguntar ao eng. Salgueiro sobre o porquê das travessias nesta peça."; value = "Nota 12 - 29/12/2011 10:00 - Foi confimada a informação das travessias com o eng. salgueiro, foi"; value = "criado um pdf da nova alteração dos telefones para o sr. pacheco, e também foi impresso um A4"; value = "somente desse traçado para ele, foi-lhe dada a medida do tritubo."; value = "Nota 13 - 02/01/2012 10:06 - Foram impressas cópias em A4 dos traçados de BT e Telefones para o"; value = "José Carlos Melrinho."; value = "Nota 14 - 02/01/2012 15:45 - Foi alterada a planta dos telefones devido a ter sido feita uma"; value = "alteração da base de acordo com o levantamento topográfico de obra do Eng. João Nunes, a alteração"; value = "constou do lancil de entrada do complexo desportivo, a entrada está mais alargada que na base que"; value = "existia anteriormente, estas alterações foram pedidas pelo sr. pacheco, foram também feitas"; value = "medições para ele."; value = "Nota 15 - 02/01/2012 16:14 - Esta nota serve para guardar um slide da planta de BT que vai ser"; value = "agora alterada devido à modificação da base ter sido mudada para a do eng. joão nunes."; value = "Nota 16 - 03/01/2012 10:11 - Foi alterada a planta da rede BT devido á nova base do eng. joão nunes"; value = "levantada em obra. Foram criados ficheiros pdf desta alteração e da anterior dos telefones e"; value = "enviados para a rede do Sr. Pacheco."; value = "Nota 17 - 03/01/2012 12:29 - Foi alterado o traçado da rede de telefones e criado um pdf para o sr."; value = "pacheco."; value = "Nota 18 - 03/01/2012 12:30 - Foi alterada a rede BT e criado um pdf para o sr. pacheco."; } } ok_only; } I guess I can only have one value = ; item? Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 I think I'm almost on my way but with a list_box Quote
irneb Posted January 11, 2012 Posted January 11, 2012 I think I realize where your issue comes from: You're creating the DCL file dynamically - thus adding a new text part for each line. You need not do this at all. And it's going to make the dialog enormous! You could simply have a static DCL file with one of :text or :edit_box or :list_box. Then all you need do is add the lines of text to that tile's value / list. E.g. Say you obtain all the text into one single variable using strcat. Though there is a limit: text & edit_boxes have a limit of around 2000 characters. Thus if your text is more than that, you need to use a list_box. And sorry, no the edit_box doesn't wordwrap (I was mis-remembering OpenDCL's Edit field). Anyhow, save the attached sample files to a support folder and load the ListText.LSP file. Then run the ListText command, choose which type of dialog you want. Note - as is the Text / Edit dialogs would error with a "Capcity of tile value exceeded" alert. If you edit the ListText.TXT file (which is simply the Readme file in the VBA samples) to remove everything from around the middle of the paragraph starting with -ExcelLink.dvb you should have something which is less than 2000 characters and the Text & Edit will also work. Though you'll see the Edit box shows everything on one single line. So actually Lee's given you the most useful tip: List boxes - see also in samples. ListText.LSP ListText.txt ListText.DCL Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 Thanks alot for your info, I'm now trying to join the text in one single line. Now the dcl file is the same. I'm having some problems but I think I can sort it out. Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 I have already tested the list_box with a pretty big number of lines. Now I just have to format the text in my lisp. But I'm having some problems. Quote
pBe Posted January 11, 2012 Posted January 11, 2012 Not that it maters, If i need to a focus point on my DCL i use highligt sanple Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 you mean highlighting something? If that's it I find it very useful. thanks a lot! Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 Finally I got it working but now there is a new problem! depending on the dwg file I run the lisp on.. the dialog will have different width? I don't get it. Quote
Brick_top Posted January 11, 2012 Author Posted January 11, 2012 I think I understand now. Could it be because i'm using the dwg file name in the Label of the dialog box? Example: This: info_dcl : dialog {label = "Histórico do ficheiro - forum-maio03-EXE-RECTIFICAÇÃO-7.04_completo.dwg"; gets a larger dialog than This: info_dcl : dialog {label = "Histórico do ficheiro - Lista.dwg"; Can I avoid it? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.