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 13-05-2008, 08:53
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default VB Form from Object Click

Hi All, Just curious... this probably isn't possible... but I figured I'd ask anyway!

Is it possible to have VB sit around in the background and wait till I click a specific object in my Corel file, lets say a specific box, and upon clicking this box, a VB form appears on my screen?

A button of sorts I guess you could call it that starts a form for me... but that button just happens to be am object in the document?

Thanks,
B
Reply With Quote
  #2  
Old 13-05-2008, 10:38
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

only a somewhat clumsy way:

VBAEditor: in "ThisMacroStorage" module of your macro project, choose "GlobalDocument" in the upperleft dropdown box on top of the code window, an empty function apperas, then immediately choose "SelectionChange" in the nearby box to the right. Remove the other unneeded function (auto created on first click of topleft box). Put the code to check ActiveShape and call the form.

Code:
Private Sub GlobalDocument_SelectionChange()
   if ActiveShape is nothing then exit sub
   if ActiveShape.Name="TriggerHappy" then MyForm.Show
End Sub
Reply With Quote
  #3  
Old 13-05-2008, 11:21
bprice's Avatar
bprice bprice is offline
Member
 
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default very cool!

very cool... and many thanks! HOWEVER... hahaha this gave me an undesired result of having my form show up every time i needed to move it etc. ... I never thought of this!

is there a way to assign a property that I have to be holding shift or some other key and click the object to make it appear? That way I can move it, and only make my form appear when I'm holding shift...

and just a side note... I've done this before but I can;t remember how to now... I'm having the form insert text into the object... how to do I "unselect" the object when I am done?

Last edited by bprice; 13-05-2008 at 11:30.
Reply With Quote
  #4  
Old 13-05-2008, 11:30
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

you can analyze whether it was selected previously:

Code:
Private Sub GlobalDocument_SelectionChange()
   static prevShape as shape
   if not ActiveShape is nothing then
      if ActiveShape.Name="TriggerHappy" then 
         if not ActiveShape is prevShape then MyForm.Show
      end if
   end if
   set prevShape=ActiveShape
End Sub
Getting shift keys state - search this forum for GetKeyState
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
copy length or width form other object vindaa CorelDRAW/Corel DESIGNER VBA 7 17-02-2008 14:07
Click and Drag Scaling similar to CAD applications JSC Feature requests/wishlist 2 31-10-2005 11:27
Background to object Fine! But Object to Background - How? marian General 2 15-07-2005 03:51
object variable not found graphicdesigner CorelDRAW/Corel DESIGNER VBA 4 22-11-2004 18:13
Bounding lines around an object toy4mud CorelDRAW CS 2 04-11-2004 11:56


All times are GMT -5. The time now is 09:25.


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