Put Things into Different Containers Depending on which Dialog Box Button Clicked - futures io
futures io futures trading



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


Discussion in Sierra Chart

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

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

(login for full post details)
  #1 (permalink)
Paris, France
 
 
Posts: 1 since Jan 2019
Thanks: 0 given, 0 received

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

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(169 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(116 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 


futures io Trading Community Platforms and Indicators Sierra Chart > Put Things into Different Containers Depending on which Dialog Box Button Clicked


Last Updated on January 27, 2019


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts