|
if showmodal = false then macro does not pause at form show.. ?
hi,
i hoping somebody can help me with my form issue. i need to set the showmodal to false because the user needs to get some demensions from the part and input them in the fields of the form. now that the showmodal is set to false the macro does not pause at the form.show but i need it to. does somebody know how this can be done.
some of the examples i found where the macro is paused for a certain period of time specified by the programmer might do it but i would never know how it will take the user to measure the part. i would need the macro to be paused until the user presses ok.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
edited: 11/27/2008 at 11:03 am by ben guenther
hey ben,
this sounds very strange...
are you saying that the ok button function call gets called when you show your form?
--stav.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
you need to show the form and instead of the code going below the form.show, you need to move it to the forms code when it closes or on a button click function
stavros,
no the ok button is not being called, the form is just shown then being ignored and the rest or the code is executed.
luke,
i am not quite sure that i understand entirely which code is all to go into the forms code as it is a very large macro and this form is caught somewhere in the middle of all the code, but i will experiment and let you know. thanks
thanks for the reply guys.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
answer being that there is alot of code left to execute after the from is shown i figured that it might be alot of work to move all the code form the modules to the form so i found an alternative:
forms code:
private sub cmdok_click()
frmsize.hide
continue = true
end sub
module code:
sub main()
continue = false
frmsize.show
do
doevents
loop until continue = true
end sub
might be a cheap fix but it works.
thanks for the help though.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
bad idea for processor time even though doevents is techincally just delegating all processor time straight on to the next process so it shouldn't harm the time, but as you say a quick fix.
the correct way to do is it so have even driven processes, so your main() function just shows the form, and thats it. then in the form you have a button or whatever, and when that button is clicked you call another function to do what you require (whatever is usually after the form.show in the main function).
i agree with what you are saying, but in order for that to work i would have to have all the remaining code in the click event is that right ?
if i would just have the next function in the click event and the rest of the functions where they are then it would just skip the function that is in the click
event and continue.
unless i had each function that ran call the next function then that would work.
currently i have a sub main() in it a few functions are called then i have another sub that is very large and lots of functions are called from it and in that sub is where i am showing this form from, so i would i then have to organize my code like a chain you have to go through all the links to get to the bottom ?
i hope that you can understand what i wrote above.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
the basic principles are that you open a form, and on the click event of a button on the form you call ideally one function. this could be called start, and you could just straight cut/paste all the code below the orginal form.show part of your code and paste it into the start function, if your code is structured correctly.
to be honest it sounds like you have lost your coding structure a little in spagettee junction. if you email me your code i can take a quick look to see if it is simple enough to fix
luke,
i agree with you i think i have lost my coding structure so it probably would not be easy to set up for this to work properly. i would like to send my code to you for that reason and to see what you think, as i am a beginner and would like an opinion but unfortunatly i do not have the permission to do that.
i think i have a pretty good idea of what you mean as of how it should be set up. i'm not sure if i will do that with this project as i have found an alternative, unless i run into too much trouble with it.
thanks alot for your help, it is much apreciated.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
hi luke,
i have decided to take the time and set my code up the way that you mentioned.
i am making it an exe rather than a macro and then i do not have the option of showmodal true or false.
i ran into one problem, one of my forms is being shown inside of a loop. every time the loop runs another round the form reshows, so i have to have the word loop after the form.show so then what you mentioned does not work.
do you have any advise for me how to deal with this ?
or anybody for that matter ?
thanks.
solidworks 2006,2007,2008,2009 (office premium.)
core 2 duo e6850 @ 3.00 mhz
window xp pro sp3 32 bit
ati firegl v7350
what is your loop doing? is it showing the form and waiting for a response, then processing the data and re-showing the form? what exactly are you trying to achieve |
|