OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 16-09-2004, 08:40
drg
Guest
 
Posts: n/a
Default Add Custom Buttons..

For binding the custom button to the program we use the following:
(Before we create a toolbar TEST (only 12 Corel))
Application.CommandBars("TEST").Controls.AddCustomButton "2948", "globalmacros.module.sub", 3, False

globalmacros.module.sub << This line starts our sub from gms module.

But how to create the button which starts not the vba-program, and add-in the program?

I install the Plotter11 (Alex-soft) there coustom button work all right.

How you created this button (to Alex)?
Reply With Quote
  #2  
Old 16-09-2004, 11:37
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Add Custom Buttons..

Plotter isn't an add-in. It IS a macro. I just install an extra GMS module.

Also, I do not add the button programmatically. The setup just installs a separate workspace which I created manually on my machine and added the macro button to the toolbar.

I hope this helps.
Reply With Quote
  #3  
Old 16-09-2004, 14:05
drg
Guest
 
Posts: n/a
Default

Earlier I too exported a part of WorkSpace (my toolbar), but here there is a problem with language compatibility (only in Corel 11): the toolbar for the English version Corel does not work for other languages Corel.

And program, which I now have written can not be as macro, since it should work quickly (algorithm of figured accommodation of graphic elements on a sheet).

It should seems to me to exist any way of introduction of a toolbar in CorelDRAW for add-in...
Reply With Quote
  #4  
Old 16-09-2004, 14:35
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

I can tell you for sure that there are no ways of adding a toolbar button for an add-in.

However I'm not convinced that your program cannot be a macro. VBA macros are pre-compiled also and almost as fast as compiled VB exe's. Just look at my CurveWorks. All the curve processing is done in pure VBA. I just read in curve information from CorelDRAW, then process all the curves using VBA's arrays, and internal functions, then put the nodes back in the curve. Of course, if you go and start operating nodes in CorelDRAW document one by one it will be slow, but not because VBA is slow, but because CorelDRAW is slow and it does a lot of things (like logging transactions each time you modify a document so that the user can Undo the change).

Just run the following simple macro:

Code:
Sub TestSpeed()
    Dim tm As Double
    Dim i As Long
    Dim a As Double
    
    tm = Timer
    For i = 1 To 1000000
        a = Sin(12.7)
    Next i
    MsgBox "It took " & (Timer - tm) & " seconds to execute"
End Sub
It calculates a Sine function a million times. When run from CorelDRAW's VBA, on my machine it takes the macro to complete in 0.14 seconds. When I created a Visual Basic 6 stand-alone project and compiled it into an EXE and run, it took it 0.10 seconds. Yes, it's almost 1.5 times faster, but that's only that much. I really doubt that your project will really suffer from this kind of difference...

Just my opinion.
Reply With Quote
  #5  
Old 16-09-2004, 15:38
drg
Guest
 
Posts: n/a
Default

But I use up to 8 enclosed cycles for... next, where from each fifth level the function also having investments of cycles is caused. 1.5^8 = it is long.
Plus difficult multilevel variable (it requires algorithm). It is all underestimates productivity of the program at 10-13 in VBA / VB6!

Now unique for me a way of a conclusion of a toolbar, this creation of a window atop of others with buttons as on a toolbar, but it is not pleasant to some my users.
Reply With Quote
  #6  
Old 16-09-2004, 17:23
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default

Well, it doesn't really matter how many levels of loops you have, the relative difference will be the same. Yes, each program will execute slower, but in the end the difference will still be pretty much the same - 1.5 times. Now, this figure was for calculating Sin in a simple loop. This could be different if you are doing some string manipulation or arrays or stuff like that, but I would suspect it will not be that much different, because most of those are still done in VB runtime DLLs which are exactly the same for both VB program and VBA.

If anything else, I would still create your DLL, export some functions, then create a simple macro which will call those functions. But doing this, you'll still have a "macro" to put a button on toolbar and your actual code will be in a DLL... Might be a solution.
Reply With Quote
  #7  
Old 17-09-2004, 07:36
drg
Guest
 
Posts: n/a
Default

1. Yes, it is valid investments the roles do not play.
But I have forgotten to tell, that before compilation of the program, I include Advanced Optimization:
Assume No Alising
Remove Array Bounds Checks etc.

It raises productivity at 10-50 times!!!

2. It is interesting idea. But I shall try still to create a toolbar.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom crop and invert - Is this possible? geopig Corel Photo-Paint VBA 1 01-11-2004 14:28
creating command buttons bumblebee CorelDRAW/Corel DESIGNER VBA 1 31-08-2004 09:35
Custom Command Buttons ddonnahoe CorelDRAW/Corel DESIGNER VBA 1 30-01-2004 16:11
Trying to make buttons from my scripts click101 CorelDRAW/Corel DESIGNER VBA 0 10-09-2003 11:41
How can I change middle colors in a custom Fountain Fill Steve CorelDRAW/Corel DESIGNER VBA 3 13-12-2002 20:11


All times are GMT -5. The time now is 05:52.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com