Author Topic: GUI control not available during callback time  (Read 9062 times)

cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
GUI control not available during callback time
« on: June 28, 2007, 05:39:45 PM »

I'm calling for_each_buffer('SelectiveDisplay_Callback'); with this function as an argument.

In Ome_SelectiveDisplay_Callback, I"m referencing a control on the GUI- but when this line executes
lblFilesProcessed.p_caption = "Files Processed = " g_processedFileCount;

the stack trace states that lblFilesProcessed does not exist.

Here is the code from the GUI which defines that control

   _label lblFilesProcessed {
      p_alignment=AL_CENTER;
      p_auto_size=false;
      p_backcolor=0x80000005;
      p_border_style=BDS_NONE;
      p_caption='Files Processed = 000';
      p_font_bold=true;
      p_font_size=10;
      p_forecolor=0x80000008;
      p_height=420;
      p_tab_index=9;
      p_width=2865;
      p_word_wrap=false;
      p_x=2040;
      p_y=4680;
   }

My only conclusion is that the GUI controls are not accessible during the callback- but that doesn't really make sense to me.

Does anyone have any comments on this issue?

Thanks

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: GUI control not available during callback time
« Reply #1 on: June 28, 2007, 06:21:17 PM »
Do you know or ensure that the right (to which the ctrl belongs) window is active ?
Or you could explicitely refer to the control: windowId.lblFilesProcessed.p_caption = ...

HS2

cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
Re: GUI control not available during callback time
« Reply #2 on: June 28, 2007, 08:46:44 PM »
Do you know or ensure that the right (to which the ctrl belongs) window is active ?
HS2

Not sure- but I think it is, since it is in the foreground, and I clicked on a cmd button to initiate all of this.
None of the other controls have this problem- only the labels, and there are 3 labels which have this same problem.


cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
Re: GUI control not available during callback time
« Reply #3 on: June 28, 2007, 09:07:06 PM »
Or you could explicitely refer to the control: windowId.lblFilesProcessed.p_caption = ...
HS2

When I add the window id as in
p_window_id.lblFilesProcessed.p_caption = "Files Processed = " g_processedFileCount;

'Control lblFilesProcessed must be declared or cannot be a member of a non-struct/union class type'

is displayed, when I press F12

The call to find_control does not find this control at runtime either
find_control("lblFilesProcessed");


Do I need to reference the event table to access a control at this time??
« Last Edit: June 28, 2007, 09:09:39 PM by cappy2112 »

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: GUI control not available during callback time
« Reply #4 on: June 28, 2007, 09:13:57 PM »
You could try the '_nocheck' declaration of the control:
Here an example:
Code: [Select]
   _nocheck _control _sellist;

   int form_wid = p_active_form;
   // HS2: let focus stick to list ! (+ see below)
   form_wid._sellist._set_focus();

A small explanation is also included in the help:
Help -> Search '_nocheck'

Good luck,

HS2

cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
Re: GUI control not available during callback time
« Reply #5 on: June 28, 2007, 09:50:02 PM »
You could try the '_nocheck' declaration of the control:
Here an example:
Code: [Select]
   _nocheck _control _sellist;

   int form_wid = p_active_form;
   // HS2: let focus stick to list ! (+ see below)
   form_wid._sellist._set_focus();

A small explanation is also included in the help:
Help -> Search '_nocheck'

Tried this-  didn't work either.
I still get a stack dump at runtime, so I've removed all the labels that have this problem, and will start again.


I wonder if this is just a bug in the macro language.

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: GUI control not available during callback time
« Reply #6 on: June 28, 2007, 10:05:15 PM »
I don't think that it's a Slick-C bug, but GUI stuff can be tricky as you surely know.
It's been always very helpful if you find sth. similar in the product (sources) to compare your solution with or to find 'the nifty trick' you just didn't know ...

HS2

cappy2112

  • Community Member
  • Posts: 91
  • Hero Points: 0
Re: GUI control not available during callback time
« Reply #7 on: July 23, 2007, 06:33:38 PM »
I don't think that it's a Slick-C bug, but GUI stuff can be tricky as you surely know.
It's been always very helpful if you find sth. similar in the product (sources) to compare your solution with or to find 'the nifty trick' you just didn't know ...

HS2
Agreed, but one needs to know 'what' to look for.

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: GUI control not available during callback time
« Reply #8 on: July 23, 2007, 06:48:32 PM »
Agreed - this is the difficult part ;)
HS2