Page 2 of 3

Re: Viewer color

Posted: Wed Jun 15, 2022 8:23 pm
by TomKerekes
Hi Taras,

That's a bit more complicated. Screen Script has the capability to change the Background bitmap. See how it is done in Screen.cpp function

int CScreen::DoMainDlg(CStringW s)

if condition

if (BGFile_loaded != BGFile)

I suppose you could also create a Main Dialog Screen Script line such as:

Main:CX:1258,CY:961,BackColor:C0C0C0,Caption:1,MaxBox:1,MinBox:1,ResizeFrame:0,Maximize:0,BackBitmap:Images\tileable-metal-textures-8.jpg

and pass it to that function.

HTH

Re: Viewer color

Posted: Thu Jun 16, 2022 6:58 am
by Tarasevih
Did I understand you correctly ?
I include the contents of Screen
#include "Screen.h"
Then I try to change the image in the script.
void CKMotionCNCDlg::SetBigValueColor(CDisplay *Disp,int axis, bool KMotionPresent, bool DisplayedEnc)
{
if (m_Simulate)
Disp->SetTextColor(0xFFFFFF);
else if (KMotionPresent && (MainStatus.Enables & (1<<CS_axis[axis])) && CS_axis[axis] >= 0)
{
if (m_ShowMach)
Disp->SetTextColor(0x0080FF);
else
if (DisplayedEnc)
Disp->SetTextColor(0xFFC000);
else
Disp->SetTextColor(0x00FF00);
}
else
Disp->SetTextColor(0x00FFFF);
Screen.BitmapFile - how to point the way forward?
}

Regards,
Taras.

Re: Viewer color

Posted: Thu Jun 16, 2022 5:59 pm
by TomKerekes
Basically yes. But Screen.h is already included. And SetBigValueColor is called for all 6 axes ten times per second. So you will want to decide what to do if various DROs are different colors. And only change the bitmap when something changes that should change the bitmap.

Re: Viewer color

Posted: Thu Jun 16, 2022 7:54 pm
by Tarasevih
Thank you Tom!

I would like you to help me write the function call correctly.
How to upload a new image?
This expression will not be correct. - Screen.BackBitmap:Images\tileable - metal - textures - 8.jpg;
What should I write after Screen.BackBitmap ?

Regards,
Taras.

Re: Viewer color

Posted: Thu Jun 16, 2022 11:22 pm
by TomKerekes
Hi Taras,
How to upload a new image?
You don't need to "upload" it. Just put it somewhere.

This expression will not be correct. - Screen.BackBitmap:Images\tileable - metal - textures - 8.jpg;

What should I write after Screen.BackBitmap ?
Screen. wouldn't be appropriate. The idea is to create a screen script string (wide string) that includes the file name of your bitmap. If placed in the KMotionCNC\res\images folder it can use a relative path. Note because a slash is the escape character to add special characters to put in an actual slash a double slash is used. Then pass it to that function. Something like:

Code: Select all

		CStringW ws = L"Main:CX:1258,CY:961,BackColor:C0C0C0,Caption:1,MaxBox:1,MinBox:1,ResizeFrame:0,Maximize:0,BackBitmap:res\\images\\MyBitmap.png";
		Screen.DoMainDlg(ws);

Re: Viewer color

Posted: Fri Jun 17, 2022 9:10 am
by Tarasevih
Hi Tom.
I'm from Ukraine.
I am very grateful to you.
I did it. The further the more I like to work with the program.
My goal is to make the program interface more attractive and efficient.
I make my machine control based on the EloPOS monoblock complete with Kflop.Monoblock touch and control menu in KMotionCNC is not convenient for touch input.That's why I'm distracting you for which I apologize.
I want to make KMotionCNC controls look like DATRON Dynamics.
The photo below shows a similar menu.
It will not be a one-on-one copy, but it will be similar.
If you do not mind, I will distract you about this?

Thank you Tom!
Regards,
Taras.

Re: Viewer color

Posted: Fri Jun 17, 2022 6:23 pm
by TomKerekes
Hi Taras,

Feel free to ask specific questions. Especially if you are willing to make the source code public.

Stay safe

Re: Viewer color

Posted: Sat Jun 18, 2022 7:28 am
by Tarasevih
Thank you Tom!
Of course the code will be available to everyone.

Regards,
Taras.

Re: Viewer color

Posted: Tue Jun 21, 2022 8:58 pm
by Tarasevih
Hi Tom.
Maybe I'll be gone for a while.
Now we are assembling the machine to order. And for one thing, I would like to assemble a stand for a monoblock and a remote control to make it more convenient to work.I have at the moment the only question. Why can't I rotate the view in the processing window?
My only question at the moment is how to rotate the view in GViewer ? Like in this video https://www.youtube.com/watch?v=VkBhYpyGpNU
I can move it but I can't rotate it.

Regards,
Taras.

Re: Viewer color

Posted: Tue Jun 21, 2022 10:10 pm
by TomKerekes
Hi Taras,

I'm not sure I understand the question. Do you have a mouse? Hold both left and right mouse buttons down to rotate.