Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Ctrl creation via dll stuff
Ctrl creation via dll stuff [message #49426] |
Thu, 08 February 2018 17:08  |
luoganda
Messages: 211 Registered: November 2016
|
Experienced Member |
|
|
I have a main loop and all in main.exe, but want to assign new ctrl(that is for Tab)
through dll, any suggestions about that?
It works ok, but when any functions being displayed as TopWindow,like PromptOK,
it complains something about "Top...".
And another one:
when assigning new TopWindow as a child to any Ctrl, then it works(opens) as child Ctrl,
is this the intent? probably yes.
Wouldn't it be easier to use TopWindow(orNewDerivedOne) instead of DHCtrl?
I don't know much about code in there, but that may be somehow complicated.
And another one / how to get Ctrl rect relative to main TopWindow?
|
|
|
Re: Ctrl creation via dll stuff [message #49434 is a reply to message #49426] |
Fri, 09 February 2018 13:53   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
luoganda wrote on Thu, 08 February 2018 17:08I have a main loop and all in main.exe, but want to assign new ctrl(that is for Tab)
through dll, any suggestions about that?
It works ok, but when any functions being displayed as TopWindow,like PromptOK,
it complains something about "Top...".
Maybe you could quite the whole complaint here...
Quote:
And another one:
when assigning new TopWindow as a child to any Ctrl, then it works(opens) as child Ctrl,
is this the intent? probably yes.
Yes.
Quote:
Wouldn't it be easier to use TopWindow(orNewDerivedOne) instead of DHCtrl?
No. If you use TopWindow derived Ctrl as child, it is child (and does not have host platform widget handle, e.g. HWND). The idea is rather that you e.g. have some dialog that you want to use both standalone and as tab of some larger dialog.
Quote:
And another one / how to get Ctrl rect relative to main TopWindow?
What exactly does that mean?
[Updated on: Fri, 09 February 2018 13:53] Report message to a moderator
|
|
|
|
|
|
Re: Ctrl creation via dll stuff [message #49658 is a reply to message #49426] |
Thu, 22 March 2018 21:46   |
luoganda
Messages: 211 Registered: November 2016
|
Experienced Member |
|
|
DLL_APP_MAIN fix:
I remember that i had similar problem when not using hinstDll.
GetModuleHandle... did not returned same value, so
UPP::Ctrl::InitWin32(hinstDll/*AppGetHandle()*/);
Maybe adding UPP:: in front to all, like in EXE_APP_MAIN.
DHCtrl in TabCtrl:
I am not sure yet for this, maybe testcase another time, but:
how do i get any Ctrl rect position relative to TopWindow? And possibly in Layout override func?
Now i am using
rc=GetRect(); struct sZ{int x,y,w,h;}sz={rc.left,rc.top,rc.Width(),rc.Height()};
but rc.left/rc.top is always zero - how do i get that?
And, by the way, can another exe be implemented - something like a plugin - into upp application,
or is too much trouble implementing this because of separate event loops and such?
[Updated on: Thu, 22 March 2018 21:47] Report message to a moderator
|
|
|
Re: Ctrl creation via dll stuff [message #49659 is a reply to message #49658] |
Fri, 23 March 2018 10:20   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
luoganda wrote on Thu, 22 March 2018 21:46
DHCtrl in TabCtrl:
I am not sure yet for this, maybe testcase another time, but:
how do i get any Ctrl rect position relative to TopWindow? And possibly in Layout override func?
Now i am using
rc=GetRect(); struct sZ{int x,y,w,h;}sz={rc.left,rc.top,rc.Width(),rc.Height()};
but rc.left/rc.top is always zero - how do i get that?
I guess I do not fully undestand the question, but in general: If you want to get relative position of two (possibly) unrelated Ctrls, the easiest way is to use GetScreenView (or GetScreenRect if you want 'outer' dimensions) and compute it from these.
Quote:
And, by the way, can another exe be implemented - something like a plugin - into upp application,
or is too much trouble implementing this because of separate event loops and such?
[/quote]
ATM no. Would be nice to have, not all that hard to do IMO. Not a priority for me right now...
Mirek
[Updated on: Fri, 23 March 2018 10:20] Report message to a moderator
|
|
|
Re: Ctrl creation via dll stuff [message #49738 is a reply to message #49426] |
Sun, 15 April 2018 11:57   |
luoganda
Messages: 211 Registered: November 2016
|
Experienced Member |
|
|
Quote:I guess I do not fully undestand the question, but in general: If you want to get relative position of two (possibly) unrelated Ctrls, the easiest way is to use GetScreenView (or GetScreenRect if you want 'outer' dimensions) and compute it from these.
Yes, this is what i was asking.
DHCtrl in TabCtrl works as expected - like other controls, BUT,
zorder does not - this is when one want's to have another usual Ctrl somewhere
intersecting that DHCtrl in TabCtrl and above it, that is when DHCtrl is below it.
DHCtrl below is somehow shown - incorectly - more or less painting problems.
By the way, adding ScrollBars to Ctrl created wia dll does not work, this error is when AddFrame is called,
this was the same error message when i wanted to allocate memory in exe but then release
it in dll or vice versa, breakpoint with heap corruption.
Can for example, String(or any other) core class be used globally through exe/dll?
Or must they use some kind of allocator where class is - allocation/deallocation in exe/dll separatelly?
Exact error message was: Heap is corrupted --memory-breakpoint__61843922
|
|
|
Re: Ctrl creation via dll stuff [message #49754 is a reply to message #49738] |
Mon, 23 April 2018 11:13  |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
luoganda wrote on Sun, 15 April 2018 11:57Quote:I guess I do not fully undestand the question, but in general: If you want to get relative position of two (possibly) unrelated Ctrls, the easiest way is to use GetScreenView (or GetScreenRect if you want 'outer' dimensions) and compute it from these.
Yes, this is what i was asking.
DHCtrl in TabCtrl works as expected - like other controls, BUT,
zorder does not - this is when one want's to have another usual Ctrl somewhere
intersecting that DHCtrl in TabCtrl and above it, that is when DHCtrl is below it.
DHCtrl below is somehow shown - incorectly - more or less painting problems.
Yes, that is what I would expect. This cannot work for technical reasons.
Quote:
By the way, adding ScrollBars to Ctrl created wia dll does not work, this error is when AddFrame is called,
this was the same error message when i wanted to allocate memory in exe but then release
it in dll or vice versa, breakpoint with heap corruption.
Can for example, String(or any other) core class be used globally through exe/dll?
Or must they use some kind of allocator where class is - allocation/deallocation in exe/dll separatelly?
Exact error message was: Heap is corrupted --memory-breakpoint__61843922
First of all, it is not supported scenario at the moment. One problem here is that probably there are two heaps (one managed by .dll other by application). You can easily solve that by using USEMALLOC - that will switch off U++ heap and use standard new/delete. Expect a drop in performance (10-20% in allocation heavy code).
Mirek
|
|
|
Goto Forum:
Current Time: Fri Apr 25 12:43:12 CEST 2025
Total time taken to generate the page: 0.02051 seconds
|