Welcome to the COE Discussion Forum! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.


Forum Highlight: CATIA V6

 

Get Answers to Your V6 Questions
Dassault Systèmes answers user questions about CATIA V6.  Discuss these answers and propose new questions with end users from around the world in the CATIA V6 Forum.

COE DISCUSSION FORUM
Subject: changing properties of textboxes in profile card with vb code

You are not authorized to post a reply.   
Author Messages
charlip

22 Sep 2008 12:52 PM

Hi,

I'm new with smarteam and I really need some help here. Is it possible to changes the properties of textedit boxes of a profile card in ST using visual basic? How can you set the focus back to a specific textbox in the profile card? eg. validating textboxes, if the user types the wrong info, I'd like to display a message and send the focus back to the texbox where the error originated and make the user type the right info.

 

EMAGNETTO

24 Sep 2008 03:59 PM
As far as I know you don't have access to controls properties, nor you can focus wherever you want using scripts, at least on Smarteam Editor. You can on Web Editor with some "creative" JavaScript coding.

Control properties (like color, font, etc) are stored on the database (I can give you the table name), but any change you make there will affect whole users. I think there's no API routines to access controls.

Eduardo
charlip

25 Sep 2008 10:55 AM

Thanks for answering to my post. Now since this is not possible, I created a form in Visual Studio 8 where the user types some values, when he clicks ok it validates the input and if it  does not meet the criteria  then set the focus back to either textbox this was triggered, once the input meets the criteria then exits the form(I created an exe file which it's called  from smarteam in a profile card by a Button); then I wrote a script in basic script to call this exe file that loads my form (in vs8) .the script is hooked to the event of the button in smarteam.

Now what I'm trying to do is to get the values from my form and pass them in variables in the script in order to manipulate them in any way I want. e.g I tried by using this syntax: Sstr = form1.textbox1 but I get this " Unknown function "form1"" .  Anyways, I don't exactly know how to retrieve this values from my form into variables in the script.

I appreciate your help.

 

 

 

 

 

EMAGNETTO

26 Sep 2008 02:29 PM

Let's see. Have you any experience with Smarteam API? What you want to do is not trivial if you are not used to it.
You should start with Client-Side Hooks for Client-Based Applications.pdf and use as reference SmarTeam Object Model Programmers Guide.pdf  and  STComRefGuide.chm.
There you'll find info on how to exchange data between Smarteam and your customs.

Some tips:

* Check first chapters of Client-Side Hooks for Client-Based Applications.pdf about passing info to and from Smarteam.

* If you launch your custom with a button, then you should check on Client-Side Hooks for Client-Based Applications.pdf chapter about Profile Cards Script Hooks -> On Click (more or less page 34). SecondPar RecordList provides the info you need. On ThirdPar you'll return your output.

* You should use a DLL. And reference at least some .NET Smarteam Libraries  (SmarTeam.Std.Interop.SmarTeam.SmApplic.dll , SmarTeam.Std.Interop.SmarTeam.SmRecList.dll, and others depending on your needs)

* This is an example of a Script that will call your DLL. The function parameters are fixed, you should respect this structure, as you'll see on the documentation.
Usually you get info of the object on FirstPar and SecondPar parameters (that in fact are "handlers" or memory pointers that are converted to Record Lists below.

****************************************************************
TestScript.vb
****************************************************************

Function OnClick_Test(ApplHndl As Long,Sstr As String,FirstPar As Long,SecondPar As Long,ThirdPar As Long ) As Integer

    Dim Session As SmSession
       Set Session = SCREXT_ObjectForInterface(ApplHndl)

     Dim RecListIn As Object
    Dim SecRecListIn As Object
     Dim RecListOut As Object

    Dim BufferOut As Object

     CONV_RecListToComRecordList FirstPar, RecListIn
     CONV_RecListToComRecordList SecondPar, SecRecListIn
     CONV_RecListToComRecordList ThirdPar, RecListOut

'You can check recordlist contetns   
'RecListIn.PrintToFile "","c:\Temp\OnClick_TestRecListIn.log"
'SecRecListIn.PrintToFile "","c:\Temp\OnClick_TestSecRecListIn.log"
'RecListOut.PrintToFile "","c:\Temp\OnClick_TestRecListOut.log"

    Dim PLMDB As Object
    Set PLMDB = CreateObject("YourDLL.Application"
     PLMDB.OnClick_Test(Session, RecListIn, SecRecListIn, BufferOut)


    If BufferOut Is Not Nothing Then
        RecListOut.CopyExternal BufferOut
           CONV_ComRecListToRecordList RecListOut, ThirdPar
    End If

    Set PLMDB= Nothing
   
End Function
*****************************************************************

* As I usually use on entry point Library, I use the same scructure (on VB.NET), like this:


Imports SmarTeam.Std.Interop.SmarTeam.SmApplic
Imports SmarTeam.Std.Interop.SmarTeam.SmRecList
Imports System.Runtime.InteropServices

Public Interface iMap
    '*****************************************************
    ' Interfaces: Fucntion Entries.
    '*****************************************************
    Function OnClick_Test(ByVal SmSession As SmSession, _
    ByVal FirstRec As ISmRecordList, ByRef BufferIn As ISmRecordList, ByRef BufferOut As ISmRecordList) As Integer
End Interface

Public Class Application
    Implements iMap
    Const ERR_NONE As Short = 0
    Const ERR_GEN As Short = 1
    Const ERR_REFUSE As Short = 6

    Public Function OnClick_Test(ByVal SmSession As SmSession, _
      ByVal FirstRec As ISmRecordList, ByVal SecondRec As ISmRecordList, ByRef Buffer As ISmRecordList) As Integer Implements iMap.OnClick_Test
       

'This is where I call another DLL or class inside my DLL so I split Presentation, Business Logic on layers
        With New clsOnClick_Test
            OnClick_Test = (IIf(.ClickTest(SmSession, FirstRec, SecondRec, Buffer), ERR_NONE, ERR_GEN))
        End With

'So Buffer RecordList will return info to write to Profile Card.


    End Function
End Class

**************************************************

I hope this helps.
Please contact me if you need more help!

Regards,
Eduardo

 

 

You are not authorized to post a reply.
Forums > COE Forums > SmarTeam > changing properties of textboxes in profile card with vb code



ActiveForums 3.6

    

401 North Michigan Avenue, Chicago, IL 60611-4267 | (312) 321-5153 | (800) COE-CALL (U.S.)