For the record, here is the well working code:
Code:
function drag_panel(PANEL* inPanel) {
	int old_x;
	int old_y;
	int dif_x,  dif_y;
	diag("\ndrag_panel");
	old_x = inPanel.pos_x - mouse_cursor.x;
	old_y = inPanel.pos_y - mouse_cursor.y;
	while(mouse_left) {
		diag_var("\nold_x:%4.0f", old_x);
		diag_var("\nold_y:%4.0f", old_y);
		dif_x = inPanel.pos_x - mouse_cursor.x - old_x;
		dif_y = inPanel.pos_y - mouse_cursor.y - old_y;
		if(0 != dif_x || 0 != dif_y) {
			diag_var("\nmouse_pos.x:%4.0f", mouse_cursor.x);
			diag_var("\nmouse_pos.y:%4.0f", mouse_cursor.y);
			inPanel.pos_x += dif_x;
			inPanel.pos_y += dif_y;
			diag_var("\ndif_x:%4.0f", dif_x);
			diag_var("\ndif_y:%4.0f", dif_y);
		}
		wait(1);
	}
}


You can see old_x is computed only one time, before the start of the loop.
So, it can be reused again and again because it wouldn't changed while the cycle runs.