LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

smooth panel resize

Hello,
 
I would like to arrange the controls on my panel while the panel is being resized. Unfortunately, the panel's callback function is only called (with event set to EVENT_PANEL_SIZE) after the panel has been resized (when the user releases the mouse button). When the user left-clicks on the edge of the panel to start resizing it, the panel's callback function is not executed, so I can't use it. Is there any way to catch this event?
 
Thanks,
Wim
0 Kudos
Message 1 of 4
(3,554 Views)

Hi Wim, I'm afraid you cannot get such an information on the CVI side. Instead, you need to process some Windows message in a specifica callback installed via InstallWinMsgCallback function in the Programmer's Toolbox. I made some test with this code:

1. In the main function install the callback for processing WM_SIZING Windows event:

 err = InstallWinMsgCallback (panelHandle, WM_SIZING, sizingCbk, VAL_MODE_INTERCEPT, NULL, &WHandle);

2. Here a skeleton of the callback that is called during windows sizing:

int CVICALLBACK sizingCbk (int panelHandle, int message, unsigned int* wParam,
  unsigned int* lParam, void* callbackData)

// Function to process sizing of the window
{
 switch (*(int*)wParam) {
  case WMSZ_RIGHT: DebugPrintf ("Sized on the right\n"); break;
  case WMSZ_LEFT:  DebugPrintf ("Sized on the left\n");  break;
 }

 return 1;   // According to SDK documentation function must return TRUE
}

With the same method you can process other events such as WM_MOVING. The same callback can be installed for several messages since it receives messageID in its secon parameters. I don't know how often the function is called, but it is *very* often: you may need to process lParam values (which points to a structure that holds window boundaries) to determine when to adjust controls position, otherwise you may suffer a significant overhead on the system.

I hope this helps

Roberto

Message Edited by Roberto Bozzolo on 04-26-2006 05:56 PM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(3,541 Views)

Hello Roberto,

thanks a lot for the information, I'll let you know if I can implement this successfully Smiley Happy

0 Kudos
Message 3 of 4
(3,536 Views)
Hello Roberto, it works great. I never used the InstallWinMsgCallback function. Seems like you can use it for a lot of things...
0 Kudos
Message 4 of 4
(3,510 Views)