is it possible to embed WxWidgets Controls in a MFC based application?
In detail, is there a way to use wxWidget Controls inside a MFC Control? specially CView, CFormView or CDockablePane?
I have a huge MFC appication with rich GUI features.
I need to extend this application with a feature, that user will be able to display application data by creating his own views.
I could start this task with an approach like this: XUIFramework: A GUI Framework based on XML and MFC[^]
Actually it would work with some simple MFC controls, but there will be a lot of work to make it more functional.
So my basic idea is, to use wxWidgets because of its rich functionality. But I cannot rewrite the complete application to base it on wxWidgets instead of MFC.
An further advantage of wxWidget would be, that it should be very easy to create a runtime for other systems like linux to run the user's GUI!
I have found in internet a few comments about such an approach. some says, it could be possible. But I have not found anything concrete. If I would have a very basic sample, I could start such a project.
is it anyhow possible to mix or overlay MFC Controls in OpenGL controlled screen area?
My aim is as follows:
I have 3D animation (like industrial robot visualisation). Nearby 3D objects I want to display object related information (e.g. with a CListBox Control).
I have already a lot of Controls, based on MFC Controls with enhanced functionality. I want to reuse this at top of a 3D scene?
Any ideas, if it is possible or how I should start?
Write a simple expression evaluator that takes a string like the following as input: 1+2*(3+4).
-Only integers need to be supported
-The following operators should be supported: +, -, *.
-Expressions within parenthesis should be evaluated first.
-Then the resulting expressions should be evaluated from left to right (no operator precedence)
4+(4-(2*3)+1)+4 = 7
The code should be written in such a way to support additional operators.
Assume the existence of a function tokenise, which could take a string and return an array of strings, for instance
tokenise(‘1+(2*3)+4’) would return [‘1’,’+’,’(‘,’2’,’*’,’3’,’)’,’+’,’4’]
and the functions isNumber and asNumber which would return a Boolean and integer respectively on a single string input.
We do not do exam questions here. You see, Like it or not, whether you get your degree or diploma, or not, the real test is: 'Can you do the Job.' Degrees and diploma's are there to sort the corn from the chaff. I Myself have no degree in Computer Science, for the simple reason that in the 1970's when I went to university, computers where things that only large government institutions could afford, the cost of each of them involved billions, and no one was allowing students access to expensive things like that. I studied pure mathematics instead. You are damn lucky that you have access to an affordable computer, with a power that is a large number of magnitudes greater than the machines costing billions some 40 odd years ago!
What happened? Did you miss a Semester at College, or what? Also, Is this an exercise in What? It could de C or CPP (My Guess)
Or, if it is MFC, did you write the Interface, and are now stuck for 'Where the Rubber meets the Road'
For you, and, Only for Once, just a bit of a leg up, to do my bit for humanity.
I Suggest you start searching for 'Reverse Polish Notation' (RPN) to at least get you started.
As a Further bit of help, the question does not ask you do the harder part, (writing the Tokeniser)you only have to write code to evaluate it's result. Should not take too much effort.
On pain of being blackballed by fellow members, I remark that you are requested to implement an abstract RPN execution stack.
The "official" way to do expression evaluation involves parse trees and reverse Polish notation, but I found a simpler more practical approach: Repeatedly process your list of tokens, making it one step simpler each time by applying a series of rules:
1. If you see the sequence '(', 'number', ')', replace it with just 'number'.
2. For each operator in decreasing precedence, look for the sequence 'number', 'operator', 'number' and replace it with the result of the operation.
If you end up with a single number, that's your answer. Anything else indicates a syntax error in the input expression.
I am still struggling on in Silence with Multiple threads, and See working Code break for no apparent reason following minor Edits.
I have read several articles about it, and, if I take all advice to hart, the answer is "You Can't" The Preferred Method of One Expert leads to grave Demise by another.
I am writing a Dialog Based system where a user Logs In, and, perform certain transactions. I am trying to implement a Controlled Log Out (and return to Base) in the absence of User Activity (Mouse Moves, Clicks, Kb Keys Pressed)
In Adittion, when TimeOut comes Close, a Small ProgresBar+ Message Appears , counting Down, only XX Seconds remaining.
I constructed a New Class, CTimedDialog, and a new App Class, CTimedWinApp. The Latter maintains a list of the m_hWnd of the Dialog Stack, and has a Timer, 1 tick per Second. The 'OnInitDialog' of CTimedDialog (This is a Class that sits between CDialog and the Ultimate UserDialog Class)registers the Class with CTimedWinApp. Upon Time-Out, A Registered Message(WM_TIME_OUT) is '::SentMessage'ed from the timer thread,to the hWnd from the Top of the List, following tru to the bottom, giving each dialog the chance to handle the message, and do a Cleanup (if required), and to close the all dialogs, and, so returning to the Base of the initial menu screen.
In adition, as each Dialog 'Knows' it's timeout value, I set up a separate timer in each CTimedDialog, that initially shows a Progress Bar, and a Text Message to display the remaining time. This timer updates the text with SetWindowText(...) and the ProgressControl with SetProgress(...)
Yes, the Progress Controls had their ranges set.
All worked to perfection when I built a Skeleton Application, of essentially blank Dialogs.
Started to fill in Details, Controls, etc, and the App Clock Ticks are no longer recognised.
Question, Do I have a hard to chase Bug, or, do I do something Wrong.
The Core code involved is quite large, too large to publish here, and covers several files.
I can mail the lot to whoever is interested as a ZIP.
As a Bottom line, there are multiple ways to skin a cat. MFC is capable of multithreading, witness the existence of MS-Office
We need to find the Right way of running Multiple threads in MFC from MS. The guidance for now seems to be: don't
I also consider it Unlikely, but that is what both Concept mistakes and stupid Bugs are made of.
The Tick Messages are sent to the Application. The Application has a List of Structures, consisting of: the hWnd of the Dialog, the Default TimeOut, and the Current Count. Upon every tick the Top Count get decremented, and, when it reaches 0, a Registered Windows Message, WM_REG_TIME_OUT is sent to all Dialogs, in Sequence. The CTimedDialog primitive answers to this by a virtual OnDlgTimeOut(), which by default ends the dialog by OnEndDialog(IDABORT). If the Dialog ends for "Natural" reasons, the EndDialog() of CTimedDialog Pops the reference to the Top Dialog of the list, and resets the Current Count of the new Top Object to it's Default value. I have used a CRITICAL_SECTION where needed, but did not go over the top with belts and braces.
The Time-Out bar on the dialogs is more of a debug feature than anything else. It assures me that the clock is ticking, and that things did not deadlock.
Thanks for giving me the foothold for assuring me that I am not doing something fundamentally wrong,as other books and autors seem to suggest. (NEVER mix a Worker and a GUI Thread) my Concept is at least not wrong in your judgement. I Start looking for a stupid mistake somewhere.
Timed and Activity based actions are notoriously difficult to debug.
Stupid Mistakes, (and I made many in the past 60 odd years), are the most difficult ones to find.
I'll let you know when I discover what went wrong. I also think that when I get it right, that the subject is of sufficient interest to merit an article.
Bram van Kampen
Last Visit: 31-Dec-99 18:00 Last Update: 26-Jul-21 17:40