Drawing a bitmap inside a dialog
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/02/2005 at 18:41, xxxxxxxx wrote:
Hi Rui,
all you then need to do is allocate the userarea that should be attached to your userarea fields.
So if you defined a UA in ResEdit with the ID "IDC_RUISAREA" for example, you need to call
ua = new(MyUserArea,IDC_RUISAREA,this);
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/02/2005 at 18:44, xxxxxxxx wrote:
Mmmmm, I will give it a try. What I can't understand is that is the "this" variable.
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/02/2005 at 18:51, xxxxxxxx wrote:
Hey Rui,
if you look into the COFFEE docs you can see the constructor of the class:
GeUserArea([int] id, [GeBaseDialog] dialog);
id = IDC_RUISAREA
and
dialog = this"this" is the pointer of the class it´s used in. (in this case a pointer to your dialog)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 07:16, xxxxxxxx wrote:
I tried to use:
user_x=GeUserArea(X_PIC,this);
But I keep getting this error:
(7) CLASS is not a function
What can be wrong with it?
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 08:38, xxxxxxxx wrote:
You have to use 'new' on a class to call the constructor in COFFEE:
user_x = new(GeUserArea(X_PIC,this));
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 08:57, xxxxxxxx wrote:
I still get the same error
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 09:40, xxxxxxxx wrote:
If you are going to create the GeUserArea programatically and attach to the dialog, you may need to derive your own class and use the code as in the example. My experience with this stuff in COFFEE is limited, so I usually stick with the examples and other existing code when possible.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 09:45, xxxxxxxx wrote:
No, I'm not going to create a User Area programatically. I simply want to have access to user areas I already defined with Resedit in a dialog resorce. But I think this is excessivelly complicated
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 09:57, xxxxxxxx wrote:
What´s the problem with using
new(name of your userarea class,IDC_RUISAREA,this);
?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 10:03, xxxxxxxx wrote:
Quote: Originally posted by Rui Batista on 15 February 2005
>
> * * *
>
> I simply want to have access to user areas I already defined with Resedit in a dialog resorce.
>
>
> * * *In ResEdit you only define the UserArea gui, but that won´t create a GeUserArea instance for you. You have to derive your own class from the GeUserArea Base class to get access to it. There is no way around it afaik.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/02/2005 at 10:12, xxxxxxxx wrote:
Oh, ok... so I still have to derive the class. Damn, its really confusing. No wonder so many people run away from programming
I will give it a try. Probably I will only have time tomorrow. Thank you both for the time and effort into helping me out. I will report my success/failureRui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/02/2005 at 12:00, xxxxxxxx wrote:
Ok, definetely, I can't seem to make it work. This is what I wrote:
{class MyUserArea : GeUserArea { private: var bbm; public: MyUserArea(id,dialog); Init(); GetUserWidth(); GetUserHeight(); Draw_Pic(name); } MyUserArea::MyUserArea(id,dialog) { super(id,dialog); } MyUserArea::Init() {var bm_path,bbm; bm_path=GeGetRootFilename(); bm_path->RemoveLast(); bm_path->AddLast("align_pics"); bm_path->AddLast("x01.jpg"); bbm=new(BaseBitmap,82,82); bbm->Load(bm_path,0); if(!bbm) { println("Error getting a picture."); return; } } MyUserArea::GetUserWidth() { return 82; } MyUserArea::GetUserHeight() { return 82; } MyUserArea::Draw_Pic(name) {var bm_path,bbm; OffScreenOn(); SetClippingRegion(x1,y1,x2,y2); name=stradd(name,".jpg"); bm_path=GeGetRootFilename(); bm_path->RemoveLast(); bm_path->AddLast("align_pics"); bm_path->AddLast(name); bbm=new(BaseBitmap,82,82); bbm->Load(bm_path,0); if(!bbm) { println("Error getting a picture."); return; } DrawBitmap(bbm,0,0,81,81,0,0,81,81,BMP_NORMAL); } class PluginDialog : GeDialog { private: var bc; ContainerToDialog(); DialogToContainer(); public: PluginDialog(); CreateLayout(); Init(); GetContainer(); SetContainer(_bc); Message(msg); Command(id, msg); } PluginDialog::PluginDialog() { super(PLUGIN_ID); bc = new(BaseContainer); } PluginDialog::GetContainer() { return bc->GetClone(); } PluginDialog::SetContainer(_bc) { bc = _bc->GetClone(); } PluginDialog::CreateLayout() { return LoadDialogResource(ALIGNER, PLUGIN_RES, 0); } ...
Where must I add the
new(name of your userarea class,IDC_RUISAREA,this);
?
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/02/2005 at 12:44, xxxxxxxx wrote:
In CreateLayout().
Try it like this:
PluginDialog::CreateLayout() { var retval = LoadDialogResource(ALIGNER, PLUGIN_RES, 0); ua = new(MyUserArea, id, this); return reval; }
If your user area is defined in the Dialog Resource, then you don't need to AddUserArea(). If not, you must.
Don't forget to set the id to the correct value!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 05:17, xxxxxxxx wrote:
Well, I'm not getting any errors now, but I'm not getting any picture in the user area either
This is a snippet of my code://********************************************************** class MyUserArea : GeUserArea { public: MyUserArea(id,dialog); } MyUserArea::MyUserArea(id,dialog) { super(id,dialog); } class PluginDialog : GeDialog { private: var bc; var userx; ContainerToDialog(); DialogToContainer(); turn_on_off(); public: PluginDialog(); CreateLayout(); Init(); GetContainer(); SetContainer(_bc); Message(msg); Command(id, msg); } PluginDialog::PluginDialog() { super(PLUGIN_ID); bc = new(BaseContainer); } PluginDialog::GetContainer() { return bc->GetClone(); } PluginDialog::SetContainer(_bc) { bc = _bc->GetClone(); } PluginDialog::CreateLayout() { var retval = LoadDialogResource(ALIGNER, PLUGIN_RES, 0); userx=new(MyUserArea,X_PIC,this); return retval; } PluginDialog::Init() { bc->SetData(NONE_X, NONE_X_VAR); bc->SetData(ALIGN_X, ALIGN_X_VAR); bc->SetData(DISTRIB_X, DISTRIB_X_VAR); bc->SetData(ADJUST_X, ADJUST_X_VAR); bc->SetData(NONE_Y, NONE_Y_VAR); bc->SetData(ALIGN_Y, ALIGN_Y_VAR); bc->SetData(DISTRIB_Y, DISTRIB_Y_VAR); bc->SetData(ADJUST_Y, ADJUST_Y_VAR); bc->SetData(NONE_Z, NONE_Z_VAR); bc->SetData(ALIGN_Z, ALIGN_Z_VAR); bc->SetData(DISTRIB_Z, DISTRIB_Z_VAR); bc->SetData(ADJUST_Z, ADJUST_Z_VAR); bc->SetData(AMIN_X, AMIN_X_VAR); bc->SetData(AMED_X, AMED_X_VAR); bc->SetData(AMAX_X, AMAX_X_VAR); bc->SetData(MIN_X, MIN_X_VAR); bc->SetData(MED_X, MED_X_VAR); bc->SetData(MAX_X, MAX_X_VAR); bc->SetData(SPACE_X, SPACE_X_VAR); bc->SetData(OF_X, OF_X_VAR); bc->SetData(AMIN_Y, AMIN_Y_VAR); bc->SetData(AMED_Y, AMED_Y_VAR); bc->SetData(AMAX_Y, AMAX_Y_VAR); bc->SetData(MIN_Y, MIN_Y_VAR); bc->SetData(MED_Y, MED_Y_VAR); bc->SetData(MAX_Y, MAX_Y_VAR); bc->SetData(SPACE_Y, SPACE_Y_VAR); bc->SetData(OF_Y, OF_Y_VAR); bc->SetData(AMIN_Z, AMIN_Z_VAR); bc->SetData(AMED_Z, AMED_Z_VAR); bc->SetData(AMAX_Z, AMAX_Z_VAR); bc->SetData(MIN_Z, MIN_Z_VAR); bc->SetData(MED_Z, MED_Z_VAR); bc->SetData(MAX_Z, MAX_Z_VAR); bc->SetData(SPACE_Z, SPACE_Z_VAR); bc->SetData(OF_Z, OF_Z_VAR); bc->SetData(USE_GROUP, USE_GROUP_VAR); turn_on_off(); ContainerToDialog(); } PluginDialog::turn_on_off() {var a_x,a_y,a_z,str; var bm_path,bbm; bm_path=GeGetRootFilename(); bm_path->RemoveLast(); bm_path->AddLast("align_pics"); bm_path->AddLast("x01.jpg"); bbm=new(BaseBitmap,82,82); bbm->Load(bm_path,0); if(!bbm) { println("Error getting a picture. Make sure the 'align_pics' folder is located in the same folder as the 'Aligner.cob' file."); return; } userx->DrawBitmap(bbm,0,0,81,81,0,0,81,81,BMP_NORMAL); userx->Redraw(); if(NONE_X_VAR) { Enable(AMIN_X,FALSE); Enable(AMED_X,FALSE); Enable(AMAX_X,FALSE); Enable(MIN_X,FALSE); Enable(MED_X,FALSE); Enable(MAX_X,FALSE); Enable(OF_X_TXT,FALSE); Enable(OF_X,FALSE); Enable(SPACE_X,FALSE); } if(NONE_Y_VAR) { ...
How do I place pictures in there, now?
You guys are being a great help. Thank youRui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 05:29, xxxxxxxx wrote:
call your UserArea Draw function and call the member function DrawBitmap(...) to draw your image.
See the example kuro posted
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 06:20, xxxxxxxx wrote:
Know what? Its not working yet. I just have to type:
userx->Draw(0,0,81,81)
right?
Isn't working
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 06:27, xxxxxxxx wrote:
no, you have to do it like this:
MyUserArea::Draw(x1,y1,x2,y2) { OffScreenOn(); SetClippingRegion(x1,y1,x2,y2); DrawBitmap(your_bitmap, 0, 0, 81, 81, 0, 0, 81, 81, BMP_NORMAL); }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 06:31, xxxxxxxx wrote:
I did, Samir. But I'm drawing it by calling userx->Draw(0,0,81,81); from inside my dialog routines. Or, how should I draw it?
Rui Batista
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 06:36, xxxxxxxx wrote:
? you don´t need to call it seperately. Once you call the Draw method as I posted it, it will be drawn. If you change the bitmap, all you need to do is redrawing the userarea with userx->Redraw();
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/02/2005 at 06:56, xxxxxxxx wrote:
Well, the Draw method is never called. I placed a println in there and nothing is printed to the Console
Want me to send you the listing?Rui Batista