Link to home
Start Free TrialLog in
Avatar of Azmodan
Azmodan

asked on

Design time container

This is a hard question, but I will give the points only if a true-full solution is given.

The question:
how do I make a Visual Basic program, that is a container, make belive to the controls (buttons, text-boxes) that they are in design-time, even though the program is in run time.

I need this to create an interface builder that resambles the VB interface. I know of the workarounds with dummy controls, or the controls beening at runtime but disabling all of their functionality. The fact is that Visual Basic somehow tells the controls that they are in design time and the MS standard controls act diferently under design and run time - anlike user made controls that are always is run-time. The control can determine if it is in run-time or not by using UserControl.Ambient.UserMode.
Is there a way to work with this in my own program?

thanx
Avatar of Dave_Greene
Dave_Greene

Ouch, Look at that grading record...
Avatar of Azmodan

ASKER

?
what do you mean?
Questions Asked 9
Last 10 Grades Given B C C B C B  
Question Grading Record 6 Answers Graded / 8 Answers Received
Answers  
Questions Answered 0

You have given 3 C's and not an A in the bunch.  And 2 of your questions didn't even get graded.

Hint:  If you want to ask questions on this forum you had better show some appreciation to those who help you!

Avatar of Azmodan

ASKER

Yeah.. well those previous questions were aseked an year before... is a new era now :)
  But.. can u give an answer or not?
You may as well create a new account and start fresh.

<off-thread>
Avatar of Azmodan

ASKER

Yeah.. well those previous questions were aseked an year before... is a new era now :)
  But.. can u give an answer or not?
Azmodan,

Please stick to one EE account

https://www.experts-exchange.com/jsp/qShow.jsp?ta=commspt&qid=20156196

Regards

modder
Community Support
PS,

Azmodan,

If you would like to have a better grading record, please post the URLs of the questions that you believe did deserver better grades, in hindsight, and I'll modify the grades for you.

modder
Community Support
Hi Azmodan
so you Lentzi to ? way to go man
however:
>>pierrecampe how did you done that?<<
yes well how do i explain that without writing a small book
i could post the code of the feasebility study here but that will take at lot of space
if you want i can email it to you
the code of the feasebility study not the code of the program as that is property of my ex boss and he would not be to happy about that
Avatar of Azmodan

ASKER

modder:i asked all those questions a lot of time ago... when I didn't have a good inet acces and it took a lot of time to load the page, so i just left them open...For all i care,  u can change all the questions I asked and rated to A. If u could do than... it would be very nice of u. thanx

pierrecampe: no.. Lentzi and I are two different persons, but we are co-workers and we must do this VB lookalike toghether, so when i saw that people look at my past history, I asked him to put the same question (he has a better past :).
  About the feasebility study.. yeah sure.. send it if you can. And about the code... if it's copyrighted, I understand, but if you could give some tips or something, amonymously, I can garantee that I won't tell you to your ex boss :)))
Hi Azmodan, thanks. I hope you'll find that with this new grading record the experts here will be much more willing to help you.

Cheers

modder
Community Support
Avatar of Azmodan

ASKER

thanx a lot Modder.
I saw that u disabled Lentzi's account. why? I told you we are different persons, just that we work toghether...
please reenable his account.
Done.
Avatar of Azmodan

ASKER

thanx modder

now...is there a chance i will get an answer to this question? It is very important to me.
Azmodan
the feasebility study is a program you know, and it contains all the principles to make a report-generator
only it is a study,quickly done,messy code,all principles only half inplemented etc...
but if you want it i'll send it to you by email,it really is to much trouble to laod the sources in a text editor and put it here
tips and hinds i am very willing to give but what tips and hinds ? ask a specific question and i'll try to answer
but there is one tip i can give:
if you want to make a VB clone and you have no idea how to do it then better forget it
if you have an idea how to do it be warned it is a *MAJOR* undertaking, and i know i made a report generator and that is still a far cry from a visible programming environment
however i could put the control resizing code here as it is relatively simple
ASKER CERTIFIED SOLUTION
Avatar of pierrecampe
pierrecampe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Azmodan

ASKER

Hmmm....
Avatar of Azmodan

ASKER

Hmmm....
I said that I know how to trick VB into creating dynamically some controls.

The question was: Is is posible to tell the controls (the common controls in VB) that they are in design time and not in run-time?

I have an idea how to do this with real-time controls and stuff. But I don't need the real time controls. I need only to draw them like in VB; to drag&drop them on a form, to resize, to move and to set some proprieties. Just this, no functionality for the controls.

I thought that I might use the allready existent MS controls that, for design-time are just some pretty pictures. This would save me a lot of work. But I don't know if it's posible. The answer shold be a yes or no, and if yes.. how.
Hmmm
indeed Hmmm
lets see what you ask:
------------------------------------------------------
The question:
how do I make a Visual Basic program, that is a
container, make belive to the controls (buttons, text-boxes)
that they are in design-time, even though the program is in run time.
------------------------------------------------------
well my friend you cant make believe a control *anything*
simply because a control has no mind it is just an object and an object is just a bunch of codes written by a programmer and it is the programmer that has to check whether his control is on a container in design or run mode
so if you want a control thats in design mode when its container is in run mode you'l have to code it yourself
-------------------------------------------------
I need this to create an interface builder that resambles the VB interface
-------------------------------------------------
i have given you code to do that, it shows clearly how you can treat a control at run time like vb does at design time
------------------------------------------------
. I know of the workarounds with dummy controls,
------------------------------------------------
huh what is a dummy control, and if you know of a workaround *please* tell me
------------------------------------------------
The fact is that Visual Basic somehow tells the controls that they are in design time
------------------------------------------------
that fact is unknown to me, i in my innocense thought that vb did something like i send you
but you can be sure that i will press MS *very* hard to tell me how vb does that, after all now i know that that is a *fact* so they cant deny it
i have your permission i presume to point them to this topic
--------------------------------------------------
I said that I know how to trick VB into creating dynamically some controls
--------------------------------------------------
please tel me how you trick vb to do that
i know how to do that using vb but any system to trick vb into anything is *very* welcome so please tell me
-------------------------------------------------------
The question was: Is is posible to tell the controls (the common controls in VB) that they are in design
time and not in run-time?

I have an idea how to do this with real-time controls and stuff. But I don't need the real time controls.
I need only to draw them like in VB; to drag&drop them on a form, to resize, to move and to set some
proprieties. Just this, no functionality for the controls.
------------------------------------------------------
the common controls in VB ? what are the common controls in vb ?
the common dialog ? the windows common controls ? any other activex control ? or the intrinsic vb controls ?
real-time controls ?
what are real-time controls
i gave you code to resize/move
if you dont know how to drag/drop on a form or to set properties may i suggest you RTFM
------------------------------------------------------
This is a hard question, but I will give the points only if a true-full solution is given.
-------------------------------------------------------
this is not a hard question it is a very fussy question
may i suggest you dont give any points just delete this question



 
Avatar of Azmodan

ASKER

Ok pierre...
using UserControl.Ambient.UserMode you can determine in a control if it's at run-time or design-time. Look in MSDN at the AmbientProperties object, UserMode property. This way u can determine in a control if the control is instantiated in design-time or run-time. This variable cannot be set in a container so then the controls in it think they are at design-time. VB sets this variable internally somehow.

What I mean by common controls is exactly that. The common controls that are loaded by default in the VB IDE - the button, the textbox, the picture box, the label, etc. Just that, no other fancy ActiveX by third party.

Why I need this... as I said I need to build a VB -lookalike interface. The code u gave me works just fine, and I thank you for it. It is usefull to me. But what I want is not to move runing controls around but pictures of them. That is, with the code u gave me, I move around a textbox that is functional - I can type text in it. If I try to do this for a ComboBox, when I move it, it will open as I click on it. So... what I want is to move pictures of those controls.
When I said "dummy controls" I meant to build myself some controls that just look like the actual controls, and that is probably just what i'm going to do. All this design-time talk would have been just to save me some work, in that those common controls of MS (the button, the textbox) have this "dummy" look already in them - the design-time part when they are just pictures to move around.
If you want to press MS about this... that would be just fine.
If you can't say anything else, I will accept your answer with the code, because that is good working code. ok?
Hi Azmodan
i see now what you mean
indeed the controls that dont have a mousedown event will not work
but these controls can be emulated (indeed as you say by dummy controls)
the combobox can be a usercontrol with an image of triangle in it and just a mousedown event:

'Event Declarations:
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseDown

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub

Private Sub UserControl_Resize()
    Image1.Move UserControl.Width - Image1.Width, 0
    UserControl.Height = 315
End Sub

and to do one better then vb dont say UserControl.Height = 315
but show just 2 sizing handles on it so it can only be resized horizontaly
and if you dont want to use a usercontrol a picturebox can be made to look like almost anything
a textbox where you can enter text at design time i'd say thats an advantage but if you dont want it set its locked property and if you dont want the caret dont allow it to get the focus or simply use a label control, at design time there is no difference between a label and a textbox
for lines/shapes you can test if the forms mouse is down over it and act accordingly
horizontal/vertical lines can easely be emulated by a label with just 2 sizing handles
and shapes by a usercontrol with a shape in it that you only show when the mouse is down over the shape
the bottom line is that there is no way you can save on coding, if you want it then you'l have to code it
now i know that microsoft has controls that are in fact just pictures of controls they can be found on their webside but dont ask me where, i dont know and i never can seem to find anything on their site
hope this was of some help
and please excuse me for my terce tone in the previous comment
Avatar of Azmodan

ASKER

thanx pierre
it has been helpfull