Problem Dialogue Box help

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,710
Reaction score
2,683
Points
203
Location
Dallas, TX
I am trying to get a dialogue box to work. It opens but that is it.

Code:
BOOL CALLBACK Atlantis_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext (hWnd));
	// pointer to vessel instance was passed as dialog context

	switch (uMsg) {
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			oapiCloseDialog(hWnd);
			return TRUE;
			//case IDC_ASCENTAP:
			//	sts->CreateAscentAPDlg();
			//	break;
		case IDC_PLBAYOP:
			sts->plop->OpenDialog();
			break;
			
		case IDC_RMSOP:
		if (sts->RMSSELECT==1)	oapiOpenDialogEx(g_Param.hDLL, IDD_RMS, RMS_DlgProc, 0, sts);
			break;
			
		
	case IDC_LIGHT:
		oapiOpenDialogEx(g_Param.hDLL, IDD_LIGHT, LIGHT_DlgProc, 0, sts);
		break;

	}
		break;
	}
	return oapiDefDialogProc (hWnd, uMsg, wParam, lParam);
}



Code:
BOOL CALLBACK LIGHT_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext(hWnd));
	// pointer to vessel instance was passed as dialog context

	const double step = 0.05*RAD;
	static double t0;
	double t1;
	HICON hIcon;
	HWND hDlg;
	switch (uMsg) {
	case WM_INITDIALOG:
		return FALSE;
	case WM_DESTROY:
		KillTimer(hWnd, 1);
		return 0;
	case WM_TIMER:
		if (wParam == 1) {
			t1 = oapiGetSimTime();

			if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_LIGHT)) {
				if (sts->rmslight_status == 1){

					SetWindowText(GetDlgItem(hDlg, IDC_FLOODON), "LIGHT ON");
					//EnableWindow(GetDlgItem(hDlg, IDC_STOW), TRUE);


				}
				if (sts->rmslight_status == 0){

					SetWindowText(GetDlgItem(hDlg, IDC_FLOODON), "LIGHT OFF");
					//EnableWindow(GetDlgItem(hDlgsts->rmslight_status = 0;

				}
			}

			t0 = t1;
		}

		break;
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			oapiCloseDialog(hWnd);
			return TRUE;

			break;
		}
	}
	return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
}

When I ran a debugger I put a break in the but it didn't break. It didn't break in a known box either.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,710
Reaction score
2,683
Points
203
Location
Dallas, TX
So the box opens but when I press on a button nothing happens. The RMS box does work. So when I press the button it changes color but doesn't turn the light on/off,....

Not sure why it will not break so I can see what is going on

Code:
BOOL CALLBACK Atlantis_DlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK RMS_DlgProc (HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK RMS1_DlgProc(HWND, UINT, WPARAM, LPARAM);
Code:
BOOL CALLBACK RMS1_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	Atlantis *sts = (uMsg == WM_INITDIALOG ? (Atlantis*)lParam : (Atlantis*)oapiGetDialogContext(hWnd));
	// pointer to vessel instance was passed as dialog context

	const double step = 0.05*RAD;
	static double t0;
	double t1;
	HICON hIcon;
	HWND hDlg;
	switch (uMsg) {
	case WM_INITDIALOG:
		return FALSE;
	case WM_DESTROY:
		KillTimer(hWnd, 1);
		return 0;
	case WM_TIMER:
		if (wParam == 1) {
			t1 = oapiGetSimTime();

			if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS1)) {
				if (SendDlgItemMessage(hWnd, IDC_FLOOD1, BM_GETSTATE, 0, 0) & BST_PUSHED) {
					if (hDlg = oapiFindDialog(g_Param.hDLL, IDD_RMS1)) {
						if (sts->light_status == 0){

							SetWindowText(GetDlgItem(hDlg, IDC_FLOOD1), "LIGHT ON");

							sts->light_status = 1;

						}
						else if (sts->light_status == 1){

							SetWindowText(GetDlgItem(hDlg, IDC_FLOOD1), "LIGHT OFF");

							sts->light_status = 0;

						}

					}
				}

			}

			t0 = t1;
		}

		break;
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			oapiCloseDialog(hWnd);
			return TRUE;

			break;
		}
	}
	return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);
}
h:
Code:
class Atlantis: public VESSEL4 {
	friend class AscentAP;
	friend class PayloadBayOp;
	friend BOOL CALLBACK RMS_DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	friend BOOL CALLBACK RMS1_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
Last edited:
Top