几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-04-12, 06:41 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】if showmodal = false then macro does not pause at form show

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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
OpenCSG-1.0.2 sample yogy vc编程 2 2007-07-22 04:43 PM


所有的时间均为北京时间。 现在的时间是 11:08 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多