02-28-2020 05:26 AM
Good day,
do you know how to modify the if () condition when I press a button to execute it?
if(EVENT_COMMIT == CallbackProtokolSklon)
{
WordRpt_GoToCell (tableHandle,1, 3);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_BOLD,WRConst_TRUE);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_UNDERLINE,WRConst_UnderlineNone);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_NAME, "Times New Roman");
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_SIZE, 9.0);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_TEXT_ALIGN,WRConst_AlignLeft);
WordRpt_WriteToCell (tableHandle, 1, 3, "Mezní sklon [‰]: ");
}
Solved! Go to Solution.
02-28-2020 06:23 AM
I must admit that I don't understand your question! Can you clarify it better?
02-28-2020 06:28 AM
02-28-2020 07:40 AM - edited 02-28-2020 07:43 AM
Sorry, I didn't focused on the code. The correct code for a control callback is:
int CVICALLBACK CallbackProtokolSklon (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
{
// Your code here
}
return 0;
}
where 'event' is a parameter of the callback itself.
03-02-2020 04:58 AM
Thank you for answer RobertoBozzolo,
As I wrote, I didn't want to put it in the function of calling.
I solved it differently
if(vypisSklonu==1)
{
WordRpt_GoToCell (tableHandle,1, 3);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_BOLD, WRConst_TRUE);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_UNDERLINE,WRConst_UnderlineNone);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_NAME, "Times New Roman");
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_FONT_SIZE, 9.0);
WordRpt_SetTextAttribute (g_docHandle, WR_ATTR_TEXT_ALIGN,WRConst_AlignLeft);
switch(Jazyk){
case 0:
Fmt(buffer," Mezní sklon: %f [‰]",mezSklon);
break;
case 1:
Fmt(buffer," nevim: %f [‰]",mezSklon);
break;
break;
}
03-02-2020 05:21 AM
Glad to know you solved your problem. Just out of curiosity, where is this code placed? In a control callback or is this a standalone routine?
03-02-2020 05:43 AM
I defined a global variable "vypisSklonu".
If you press the "Gradient" button, the value of the variable will be 1. and the condition is executed if(vypisSklonu==1)
int CVICALLBACK CallbackProtokolSklon (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
vypisSklonu=1;
if (Jazyk == 0)
{
protokolSklon();
}
if (Jazyk == 1)
{
protokolSklon();
}
if (Jazyk == 2)
{
protokolSklon2();
}
break;
}
return 0;
}
03-02-2020 09:33 AM
This is not what I asked. Those lines that call WordRpt functions where are located?