Orbiter-Forum  

Go Back   Orbiter-Forum > Orbiter Addons > Addon Development
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Addon Development Developers post news, updates, & discussions here about your projects in development.

Reply
 
Thread Tools
Old 07-27-2018, 04:40 PM   #1
gattispilot
Addon Developer
 
gattispilot's Avatar
Default Dialogue Box help

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 is online now   Reply With Quote
Old 07-29-2018, 11:53 AM   #2
gattispilot
Addon Developer
 
gattispilot's Avatar
Default

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 by gattispilot; 07-29-2018 at 12:51 PM.
gattispilot is online now   Reply With Quote
Reply

  Orbiter-Forum > Orbiter Addons > Addon Development


Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


All times are GMT. The time now is 03:57 PM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.