Sorta new to ActiveX, need some help |
Post Reply |
Author | |
Mark19960
Groupie Joined: 17 October 2007 Location: United States Status: Offline Points: 11 |
Post Options
Thanks(0)
Posted: 17 October 2007 at 3:07pm |
Using an eval with Visual Dataflex for starters.
(yeah, no language support.. I know :() Myself and a few others have been trying to get these controls to work and are unfortunately being held hostage by those that have figured it out for ca$h. But that is all water under the bridge. This is a pet project of mine, hopefully before the eval runs out :) This is what we have that works... (loading from an access db) This code is in a button: Boolean bOpen bOK Handle hoData_Prov hoWorkSpace String sWork sConString Variant vData_Prov //Set connection string to a sample Access db Get phoWorkspace of ghoApplication to hoWorkSpace Get psProgramPath of hoWorkSpace to sWork Move ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sWork + "\AccessSample.mdb") to sConString Send ComSetDataProvider of oComCalendarControl1 sConString //Get Data Provider object and connect to a VDF side Object Get Create U_cComCalendarDataProvider to hoData_Prov Get ComDataProvider of oComCalendarControl1 to vData_Prov Set pvComObject of hoData_Prov to vData_Prov Get ComOpen of hoData_Prov to bOpen If (not(bOpen)) Begin Get ComCreate of hoData_Prov to bOK End Send Destroy of hoData_Prov //Populate the Visual Control Set ComViewType of oComCalendarControl1 to OLExtpCalendarWorkWeekView Send ComPopulate of oComCalendarControl1 So, this works and draws the data contained in the example database just fine. Now, I am trying to get the custom provider working and just throw something on the screen manually, and this is what I have: (yes, it is bad....) Boolean bOpen bOK Handle hoData_Prov hoWorkSpace String sWork sConString Variant vData_Prov Get phoWorkspace of ghoApplication to hoWorkSpace Get psProgramPath of hoWorkSpace to sWork Move ("Provider=Custom;") to sConString Send ComSetDataProvider of oComCalendarControl1 sConString //Get Data Provider object and connect to a VDF side Object Get Create U_cComCalendarDataProvider to hoData_Prov Get ComDataProvider of oComCalendarControl1 to vData_Prov Set pvComObject of hoData_Prov to vData_Prov Get ComOpen of hoData_Prov to bOpen If (not(bOpen)) Begin Get ComCreate of hoData_Prov to bOK End Handle hEvent Variant vEvent DateTime dtVar dtEnd Move (CurrentDateTime()) to dtVar Integer iID iD Move "999" to iD Move (DateSetMillisecond(dtVar, 00)) to dtEnd Move (DateSetSecond(dtVar, 00)) to dtEnd Move (DateSetMinute(dtVar, 0)) to dtEnd Move (DateSetHour (dtVar, 17)) to dtEnd Move (DateSetDay (dtVar, 17)) to dtEnd Move (DateSetMonth (dtVar, 10)) to dtEnd Move (DateSetYear (dtVar, 2007)) to dtEnd Get Create U_cComCalendarEvent to hEvent Get ComCreateEventEx of hoData_Prov iD to vEvent Set pvComObject of hEvent to vEvent Set ComSubject of hEvent to "test" Set ComLocation of hEvent to "test1" Set ComStartTime of hEvent to dtVar Set ComEndTime of hEvent to dtEnd Get ComScheduleID of hEvent to iID //Populate the Visual Control Set ComViewType of oComCalendarControl1 to OLExtpCalendarWorkWeekView Send ComPopulate of oComCalendarControl1 And, this is what I have... My lack of understanding of how this control works, coupled with my ActiveX knowledge being nonexistant does not help me. I am, a C programmer.... not a .NET or C# programmer or VB for that matter so the examples or doc do not really do much for me other than give me syntax :( So, looking at this code from an alien language, can you guys tell me if I am at least doing things in the appropriate order, looking at the code that DOES work? Any hints would be helpful :) |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Have you read this article: http://www.codejock.com/support/articles/com/calendar/cp_3.asp?
-- WBR, Serge |
|
Mark19960
Groupie Joined: 17 October 2007 Location: United States Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Actually, I have... and that document says that if RetrieveDayEvents returns an empty events collection then the control will not display anything. So, I added: Variant vTest Get ComRetrieveDayEvents of hoData_Prov dtVar to vTest If (vTest = OLE_VT_EMPTY) Showln "vtest = empty" Thing is, that Dataflex throws an error on that because there is actually 'something' in the variable, it's just not 'OLE_VT_EMPTY' which is defined as '0' I also have: Procedure OnComDoCreateEvent Variant llpEvent Integer ByRef llNewEventID Boolean ByRef llbResult Showln "here" End_Procedure In the object and it never gets fired. If I saw this getting fired I would call that progress, but it never gets fired. Other events fire, like mouse clicks and moves and such, just not any of these. Trying to see what a 'Variant' actually *IS* in dataflex is like the boy Oliver asking for more...... your not going to get it. It just does not give you a hint, all I can say is that what it contains is something that looks to me, as a C programmer like a memory address. |
|
Mark19960
Groupie Joined: 17 October 2007 Location: United States Status: Offline Points: 11 |
Post Options
Thanks(0)
|
I have cleaned this up a lot, and explained what *should* be happening in the code.
As far as I can tell I must not be sending or setting something in this basic example. At the bottom when I try to get the data provider object using 'DataProvider' it returns the same object that is created in the beginning. So, as far as the objects all being linked and such I do believe that is actually working, even if DataFlex is a tad excessive in the way you have to do it. Again, this is in a button... On another note I have been able to do other things like utilize the hittest objects accessing them in the same fashion here, so I am pretty sure I am doing it the right way. Is there any fields I am not setting that are required for it to draw them? I have a feeling I am not far off the answer here.
|
|
Mark19960
Groupie Joined: 17 October 2007 Location: United States Status: Offline Points: 11 |
Post Options
Thanks(0)
|
I did get this to work...
Note that I am not sending: Get ComOpen of hoDataProvider to bOpen Oops. :) |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |