NexusFi: Find Your Edge


Home Menu

 





Put Things into Different Containers Depending on which Dialog Box Button Clicked


Discussion in Sierra Chart

Updated
    1. trending_up 1,286 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
doughtrader
Paris, France
 
Posts: 1 since Jan 2019
Thanks Given: 0
Thanks Received: 0

Using: http :// win32-framework [dot] sourceforge [dot] net/description.htm

I'm trying to write a Sierra Chart plugin that uses a dialog box. I found some reference code (from right here: https :// futures [dot] io/sierra-chart-programming/45896-how-do-i-go-about-making-modeless-dialog-boxes-code-provided.html#post702140) that seems close to what I need (especially based on the rest of that forum thread), but I'm trying to change it to what I need. That is, a dialog box that comes when a shortcut menu item is clicked (that part is easy-peasy once I have the dialog implemented with the win32++ framework linked on the first line).

The dialog box takes text input. There are 3 buttons. An OK button, a button to click if you want the text input to go to a list called List_1, and a second button that puts the text input into a different list called List_2. At the moment, all I have is the design for this right here generated by Visual Studio:

From `NewTestDialog.rc`:

 
Code
    IDD_NEW_DIALOG DIALOGEX 0, 0, 215, 65
    STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "New SC DLL Dialog Test"
    FONT 8, "MS Shell Dlg", 400, 0, 0x1
    BEGIN
        DEFPUSHBUTTON   "OK",IDOK,158,37,50,14
        EDITTEXT        IDC_TEXT_INPUT,7,15,201,14,ES_AUTOHSCROLL
        PUSHBUTTON      "Buy Target",IDC_PUT_IN_CONTAINER_1,7,37,50,14
        PUSHBUTTON      "Sell Target",IDC_PUT_IN_CONTAINER_2,68,37,50,14
    END

Now, below is parts from the code reference I have that is relevant to me and that I'm having trouble with.

From `OldTestDialog.rc`:
 
Code
    IDD_DIALOG DIALOGEX 0, 0, 181, 61
    STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "Old SC DLL Dialog Test"
    FONT 8, "MS Shell Dlg", 400, 0, 0x1
    BEGIN
        DEFPUSHBUTTON   "ОК",IDOK,125,44,50,14
        EDITTEXT        IDC_EDIT1,7,7,167,14,ES_AUTOHSCROLL
        PUSHBUTTON      "Start Timer",IDC_BUTTON1,7,44,50,14
    END
From `OldTestDialog.h`:

 
Code
#pragma once
    #ifndef MYDIALOG_H
    #define MYDIALOG_H
    
    class CMyDialog : public CDialog
    {
    public:
    	CMyDialog(UINT nResID,s_sc* p_interface);
    	virtual ~CMyDialog();
    
    	void UpdateSCData();
    	s_sc* m_pSCInterface;
    
    protected:
    	virtual void OnDestroy();
    	virtual BOOL OnInitDialog();
    	virtual INT_PTR DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
    	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
    	virtual void OnOK();
    	virtual LRESULT SCTimer(UINT uMsg, WPARAM wParam, LPARAM lParam);
    
    private:
    	BOOL OnButtonStartTimer();
    	CEdit     m_Edit;
    };
    #endif
and from `OldTestDialog.cpp`:

 
Code
 #include "stdafx.h"
    #include "TestDialog.h"
    
    #define ID_SC_TIMER 110
    
    CMyDialog::CMyDialog(UINT nResID, s_sc* p_interface) : CDialog(nResID)
    ,m_pSCInterface(p_interface)
    {}
    
    CMyDialog::~CMyDialog()
    {
    	
    }
    
    void CMyDialog::UpdateSCData()
    {
    	m_Edit.SetWindowTextA(std::to_string(m_pSCInterface->Subgraph[0].Data[m_pSCInterface->Index]).data());
    	m_Edit.Invalidate();
    }
    
    void CMyDialog::OnDestroy()
    {
    	KillTimer(ID_SC_TIMER);
    	::PostQuitMessage(0);
    }
    
    INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	UINT nID = (UINT)wParam;
    
    	switch (uMsg)
    	{
    		case WM_TIMER:
    		{
    			switch (nID)
    			{
    				case ID_SC_TIMER:return SCTimer(uMsg, wParam, lParam); break;
    			}
    		}
    		case WM_SYSCOMMAND:
    		{
    			switch (LOWORD(wParam))
    			{
    				case SC_CLOSE:
    				{
    					MessageBox("To Destroy this Dialog Window,\r\nyou have to remove study from chart!", "Warning!", MB_OK);
    					return TRUE;
    				}
    			}
    		}
    	}
    			
    	return DialogProcDefault(uMsg, wParam, lParam);
    }
    
    BOOL CMyDialog::OnCommand(WPARAM wParam, LPARAM lParam)
    {
    	UNREFERENCED_PARAMETER(lParam);
    
    	UINT nID = LOWORD(wParam);
    	switch (nID)
    	{
    		case IDC_BUTTON1:   return OnButtonStartTimer();
    	}
    
    	return FALSE;
    }
    
    BOOL CMyDialog::OnInitDialog()
    {
    	AttachItem(IDC_EDIT1, m_Edit);
    
    	return TRUE;
    }
    
    void CMyDialog::OnOK()
    {
    	MessageBox("To Destroy this Dialog Window,\r\nyou have to remove study from chart!", "Warning!", MB_OK);
    	return;
    }
    
    
    LRESULT CMyDialog::SCTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
    	UpdateSCData();
    	return FinalWindowProc(uMsg, wParam, lParam);
    }
    
    
    
    BOOL CMyDialog::OnButtonStartTimer()
    {
    	SetTimer(ID_SC_TIMER, 500, 0);
    	
    	return TRUE;
    }


How do I go about changing this implementation of CDialog so that it suits my needs better?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
US Navy Blockade of Hormuz Starts Today -- Oil Surges 8p …
Prediction Markets & Event Contracts
Iran Talks Final Stages -- Two VLCCs Exit Hormuz, Record …
Traders Hideout
Memorandum Watch: How the 60-Day MOU Framework Makes May …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks




Last Updated on January 27, 2019


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts