Login Page - Create Account

Support Board


Date/Time: Thu, 18 Apr 2024 04:40:59 +0000



[Programming Help] - How to get modeless dialog box working? Code Provided.

View Count: 5849

[2019-01-30 13:53:44]
doughtrader - Posts: 16
Nice example Norvik. How would you go about doing it for an input dialog box like what doetrader is seemingly trying to do? I see where you define the Timer, but what if a timer is not needed?

I also agree with User701453. Please, dear support, add examples for this area of development to the documentation. The more detailed the example the better.

Also, to add another question to mine above, how do you handle closing the dialog box via OK button without needing to remove the whole study?

How would you go about taking input from the edit box and button it into a container (list, vector, etc..) when a button is clicked?

Also does the wxx files/Win32++ Framework work with windows 10?

Also, when building, I seem to be getting this error:

MyDialog.obj : error LNK2019: unresolved external symbol __imp__InitCommonControls@0 referenced in function "void __cdecl Win32xx::LoadCommonControls(void)" (?LoadCommonControls@Win32xx@@YAXXZ)

[2019-01-31 14:45:21]
norvik_ - Posts: 106
Hi, doughtrader.
To fix linker error, post: #pragma comment(lib,"comctl32.lib") in TestDialog.cpp
Win32++ require this library. Of course it works on Win10. There are no nesessary to use exactly Win32++, the same things can be created with MFC, or winapi c functions
Timer is needed for update edit control independently from SC ChartUpdateInterval. For example, it can be updated one time during 5 seconds. You may update it directly, using SendMessage or direct reference to global resources(pointer to Dialog instance);
For writing SCStudyInterface values in Dialog instance, it is better protect them with std::mutex or CRITICAL_SECTION.
I will try to give more extended version of this project , but sorry, I have no very much time. This question relates more to common
windows c\c++ programming, it is not part of ASCIL .
[2019-02-09 05:40:48]
doughtrader - Posts: 16
Oh, I see. Thanks for expanding on all of that.

Regarding what you said here:

You may update it directly, using SendMessage or direct reference to global resources(pointer to Dialog instance);

Is this StackOverflow answer (https://stackoverflow.com/a/12491691/10713257) the way to do it for using SendMessage or is there something extra that also needs to be taken into account for Sierra Chart?

For what you said here:

For writing SCStudyInterface values in Dialog instance, it is better protect them with std::mutex or CRITICAL_SECTION.

Could you provide an code example for using std::mutex for writing SCStudyInterface values in Dialog instance?
[2019-02-10 12:07:07]
norvik_ - Posts: 106
Hi,
Is this StackOverflow answer (https://stackoverflow.com/a/12491691/10713257) the way to do it for using SendMessage or is there something extra that also needs to be taken into account for Sierra Chart?
Yes.

Keep in mind that calling SCStudyInterface functions from your dialog in most cases will have no effect. I don't know exactly why. You only can read and write SCStudyInterface variables.

Could you provide an code example for using std::mutex for writing SCStudyInterface values in Dialog instance?

For example you have an initial statement in SCSFExport:

sc.DataStartIndex = sc.IndexOfFirstVisibleBar;
sc.SimpleMovAvg(sc.Close, Average, sc.Input[0].IntValue);

You can change it in dialog:

void CMyDialog::ChangeDataStartIndex(int NewIndex)
{
std::mutex mk;
std::lock_guard<std::mutex> locker(mk);
m_pSCInterface->DataStartIndex = NewIndex;
}

Give me a week, I will post at this thread example of simple custom trading panel.
Also some things about additional windows for SC.
Date Time Of Last Edit: 2019-02-10 12:40:53
[2019-02-12 12:19:09]
doughtrader - Posts: 16
Oh, okay. I'll look forward your upcoming examples to study.
[2019-02-12 12:33:05]
User640689 - Posts: 5
I've been following this thread and have some questions.

Regarding the usage of the Timer and other options (SendMessage and updating directly). Which one would be the best to use if you were looking to send, based on input in the edit control and clicking of a certain button control, a struct to a Global Variable (not SC Persistent variables but still accessible to SC studies), that holds an std::vector of structs?


In such a case, would the use of std::mutex or CRITICAL_SECTION also be necessary?
[2019-02-13 22:18:23]
norvik_ - Posts: 106
Protecting needed only during you are writing some variable which can be used when SC calls dll function, because calling are independent events. The SRWLock is preferred, in most cases it is facter then other.
Another question is which data is used each time when SC calls dll and how SC calculates study. But this is to ask for SC developers.
So, it's only my suggestion about this protection, but in any case it can not make any wrong thing.
Of course, global variables can be used in both, dll body and Dialog but I don't see any sense, because Dialog instance can access the SCStudyInterfaceRef, and all data can be local. You can declare anything you want inside dll function
Date Time Of Last Edit: 2019-02-13 23:16:07
[2019-02-16 11:55:18]
User718622 - Posts: 57
Hi there Norvik,

Out of curiosity, what do you mean by "dll function"? Do you mean the scdll("some name")?


Your examples have been helping me a lot, So I just wanted to let you know how much I appreciate them.
[2019-02-17 00:40:54]
norvik_ - Posts: 106
Hi,

Each sc study dll exports usually, only one function - SCSFExport func(SCStudyInterfaceRef sc),
this mean __declspec(dllexport) __cdecl void func(s_sc& sc).
Of course, you can place several studies(functions) in one dll and and so you will see in sc "Add Study" Dialog
your SCDLLNAME and the tree of indicators.
Date Time Of Last Edit: 2019-02-17 09:57:11
[2019-03-03 03:50:39]
User718622 - Posts: 57
Cool. Thanks for that explanation. I saw that you mentioned an example you were working on. I hope its not too late, but I'd also be interested in seeing it.
[2019-06-30 21:55:48]
User701453 - Posts: 176
User701453
SC support.
Please provide your users a working .cpp example of how to display a fully functional and usable form.

Form should include buttons, input boxes, etc that actually perform an action when used.
A working form would/could look like screen shot of a form attached.

Its been over 6 months and Sierra Charts still haven't provided any example code for its customers.
[2019-10-13 10:29:36]
GiovanniD - Posts: 41
I too would like to see a complete example to study ..
[2021-04-04 00:34:55]
User741184 - Posts: 44
How can we create a window with a table in it using ACSIL? Can anyone please help me with this problem? Thanks!

How to create a Window with a Table in Sierra Chart Custom Study

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account