Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » QtfRichObject problem
QtfRichObject problem [message #9128] Wed, 18 April 2007 12:26 Go to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
Using U++ 207.1rc2

Modified the code QtfDrawing to try to create several drawings to be pasted into a single qtf file.

Created an array of :

RichObject ft[MAXVAL];
DrawingDraw tw[MAXVAL];

and Created them to size:

tw[i].Create(width, height);

Drawing into the space all works OK.

Then saved the RichObject after drawing with:

ft[i]=CreateDrawingObject(tw[i].GetResult(), ...)

Now I try to create a QtfRichObject with

QtfRichObject pict(ft[i]);

and convert it to string by
tree << "[i2000 " << pict << "]&";

Going round the loop several times creates the necessary number of objects but they are all the last one.

I am sure it is the fact that I have only one QtfRichObject pict
created and it uses that one several times in the physical draw.

I cannot make an array of QtfRichObjects to save away and I am reluctant to use new / pointers

Any suggestions please.
Re: QtfRichObject problem [message #9129 is a reply to message #9128] Wed, 18 April 2007 13:11 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11994
Registered: November 2005
Ultimate Member
Please, can you upload the package?

Mirek
Re: QtfRichObject problem [message #9132 is a reply to message #9129] Wed, 18 April 2007 13:38 Go to previous messageGo to next message
DuncanShortland is currently offline  DuncanShortland
Messages: 45
Registered: January 2006
Member
The application is too big but I have modified QtfDrawing to give the same effect.

I am sure it is the pict which needs to be an array.

The last contents (red) is used to display the image as it is the same one.

However the class/struct will not allow blank creation and dynamic setting.

Any suggestions?


  • Attachment: main.cpp
    (Size: 0.74KB, Downloaded 268 times)
Re: QtfRichObject problem [message #9146 is a reply to message #9132] Wed, 18 April 2007 22:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11994
Registered: November 2005
Ultimate Member
DuncanShortland wrote on Wed, 18 April 2007 07:38

The application is too big but I have modified QtfDrawing to give the same effect.

I am sure it is the pict which needs to be an array.

The last contents (red) is used to display the image as it is the same one.

However the class/struct will not allow blank creation and dynamic setting.

Any suggestions?



Use Array:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

Color col[] = {Yellow, Blue, Green, Red}; 

#define MAX 4

GUI_APP_MAIN
{
	String qtf;
	Array<QtfRichObject> o;
	
	for(int i = 0; i < MAX; i++) {
		DrawingDraw dw(100, 100);
		dw.DrawRect(0, 0, 100, 100, White);
		dw.DrawEllipse(10, 10, 80, 80, Red, 5, Blue);
		dw.DrawRect(50, 50, 50, 50, col[i]);
		o.Add(QtfRichObject(CreateDrawingObject(dw.GetResult(), Size(1000, 1000), Size(1000, 1000))));
		qtf << "[A6 This is some drawing in QTF: " << i << o.Top() << "&";
	}
	PromptOK(qtf);
}


BTW, please, if possible, upload really the whole package packed as .zip, it saves the time of reproducing the rest.

Mirek
Re: QtfRichObject problem [message #9150 is a reply to message #9146] Wed, 18 April 2007 23:01 Go to previous message
mirek is currently offline  mirek
Messages: 11994
Registered: November 2005
Ultimate Member
Thinking about it, adding a defualt constructor is a good idea too, so with the next release you will be able to do it this way too:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

Color col[] = {Yellow, Blue, Green, Red}; 

#define MAX 4

GUI_APP_MAIN
{
	String qtf;
	QtfRichObject o[MAX];
	
	for(int i = 0; i < MAX; i++) {
		DrawingDraw dw(100, 100);
		dw.DrawRect(0, 0, 100, 100, White);
		dw.DrawEllipse(10, 10, 80, 80, Red, 5, Blue);
		dw.DrawRect(50, 50, 50, 50, col[i]);
		o[i] = QtfRichObject(CreateDrawingObject(dw.GetResult(), 1000, 1000));
		qtf << "[A6 This is some drawing in QTF: " << i << o[i] << "&";
	}
	PromptOK(qtf);
}



(Or you can add def construtor now and next release will not break your code... Wink

Mirek
Previous Topic: EncodeQTF Where is it?
Next Topic: UWord Speller and 'Whats This?'
Goto Forum:
  


Current Time: Sun Aug 25 21:06:39 CEST 2019

Total time taken to generate the page: 0.00728 seconds