Hot News:

Mit Unterstützung durch:

  Foren auf CAD.de (alle Foren)
  NX
  UI-Styler + Default Action

Antwort erstellen  Neues Thema erstellen
CAD.de Login | Logout | Profil | Profil bearbeiten | Registrieren | Voreinstellungen | Hilfe | Suchen

Anzeige:

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen nächster neuer Beitrag | nächster älterer Beitrag
  
Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für NX
Autor Thema:  UI-Styler + Default Action (1204 mal gelesen)
flyer
Mitglied



Sehen Sie sich das Profil von flyer an!   Senden Sie eine Private Message an flyer  Schreiben Sie einen Gästebucheintrag für flyer

Beiträge: 48
Registriert: 10.07.2002

erstellt am: 23. Jun. 2003 16:32    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities

Hallo UI-Styler Freunde,

wenn ich einen Styler-Dialog aus einer UserFunction aufrufe,
kann ich dann auch eine Default-Action vorgeben, so dass
bspw. ein bestimmter Action-Button vorbelegt ist und dieser nur noch ueber die mittlere Maustaste bestaetigt werden muss ??????

Wenn ja...vielleicht hat ja auch jemand ein kleines Beispiel

MfG

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

berberic
Mitglied
Software-Developer


Sehen Sie sich das Profil von berberic an!   Senden Sie eine Private Message an berberic  Schreiben Sie einen Gästebucheintrag für berberic

Beiträge: 113
Registriert: 04.02.2003

Don't worry be happy.
Michael

erstellt am: 27. Jun. 2003 12:11    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities Nur für flyer 10 Unities + Antwort hilfreich

Hallo flyer,

anbei zwei Beispiele von PLMSolutions, die hoffentlich deine
Frage beantwoten.

Gruß Michael

Date:  18-SEP-2002
Subject:  Sample APIProgrammier- und Anwendungsschnittstelle (Application Programming Interface) program to set uistyler dialogs default action

/*HEAD SET_UISTYLER_DIALOGS_DEFAULT_ACTION CCC UFUN */
/*  To create a dialog to use with this program:

    - Select Application->User Interface Styler
    - Change the dialog's Prefix Name to "GTAC"
    - Specify the Constructor Callback as GTAC_"const_cb"
    - Add a Push Button object
    - Specify its Activate callback ask GTAC_"push_cb"
    - Save Dialog As "gtac"
*/

#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_styler.h>

#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
#define GTAC_ACTION_0                  ("ACTION_0")

static int report_error( char *file, int line, char *call, int irc)
{
    if (irc)
    {
        char err[133],
            msg[133];

        UF_get_fail_message(irc, err);
        sprintf(msg, "error %d at line %d in %s", irc, line, file);

        if (!UF_UI_open_listing_window())
        {
            UF_UI_write_listing_window(err);
            UF_UI_write_listing_window("\n");
            UF_UI_write_listing_window(msg);
            UF_UI_write_listing_window("\n");
            UF_UI_write_listing_window(call);
            UF_UI_write_listing_window(";\n\n");
        }
        else
        {
#ifdef _USRDLL
            uc1601(err, TRUE);
            uc1601(msg, TRUE);
#else
            fprintf(stderr, "%s\n", err);
            fprintf(stderr, "%s\n", msg);
            fprintf(stderr, "%s;\n\n", call);
#endif
        }
    }
    return(irc);
}

#define WRITE(X)  UF_UI_open_listing_window(); UF_UI_write_listing_window(X)
#define WRITE_D(X) (write_integer_to_listing_window(#X, X))

static void write_integer_to_listing_window(char *title, int n)
{
    char
        msg[MAX_LINE_SIZE+1];

    UF_CALL(UF_UI_open_listing_window());
    sprintf(msg, "%s = %d\n", title, n);
    UF_CALL(UF_UI_write_listing_window(msg));
}

/*ARGSUSED*/
static int GTAC_const_cb(int dialog_id, void *client_data,
    UF_STYLER_item_value_type_p_t callback_data)
{
    UF_STYLER_item_value_type_t
        set_value;

    WRITE("Setting default to action button...\n");

    set_value.item_attr = UF_STYLER_DEFAULT_ACTION;
    set_value.item_id = GTAC_ACTION_0;

    UF_CALL(UF_STYLER_set_value(dialog_id, &set_value));

    return (UF_UI_CB_CONTINUE_DIALOG);
}

/*ARGSUSED*/
static int GTAC_push_cb(int dialog_id, void *client_data,
    UF_STYLER_item_value_type_p_t callback_data)
{
    UF_STYLER_item_value_type_t
        set_value;

    WRITE("Setting default to OK button...\n");

    set_value.item_attr = UF_STYLER_SENSITIVITY;
    set_value.item_id = UF_STYLER_NAV_INDEX;
    set_value.subitem_index = UF_STYLER_OK_INDEX;
    set_value.value.integer = TRUE;

    UF_CALL(UF_STYLER_set_value(dialog_id, &set_value));

    set_value.item_attr = UF_STYLER_DEFAULT_ACTION;
    set_value.item_id = UF_STYLER_NAV_INDEX;
    set_value.subitem_index = UF_STYLER_OK_INDEX;

    UF_CALL(UF_STYLER_set_value(dialog_id, &set_value));

    return (UF_UI_CB_CONTINUE_DIALOG);
}

static void do_it(void)
{
    int
        resp;
    UF_STYLER_callback_info_t GTAC_cbs[3] = {
        {UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB  , 0, GTAC_const_cb},
        {GTAC_ACTION_0        , UF_STYLER_ACTIVATE_CB    , 0, GTAC_push_cb},
        {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }};

    UF_CALL(UF_STYLER_create_dialog("gtac.dlg", GTAC_cbs, 3, NULL, &resp));
    WRITE_D(resp);
}

/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
    if (UF_CALL(UF_initialize())) return;
    do_it();
    UF_terminate();
}

int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}

Date:  18-SEP-2002
Subject:  Sample APIProgrammier- und Anwendungsschnittstelle (Application Programming Interface) program to remove uistyler default action

/*HEAD REMOVE_UISTYLER_DEFAULT_ACTION CCC UFUN */
/*
    This program demonstrates a method enabling you to post a UIStyler dialog
    where there is no default action, so that nothing happens when the user
    presses the middle mouse button (MB2).  This is done by setting the default
    action to a dummy push button on the dialog, and then making this push
    button invisible.

    To create a dialog to use with this program:

    - Select Application->User Interface Styler
    - Change the dialog's Prefix Name to "GTAC"
    - Specify the Constructor Callback as GTAC_"const_cb"
    - Add a Push Button object
    - Add another Push Button object
    - Save Dialog As "gtac"
*/

#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_styler.h>

#define GTAC_ACTION_0                  ("ACTION_0")
#define GTAC_ACTION_1                  ("ACTION_1")

#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))

static int report_error( char *file, int line, char *call, int irc)
{
    if (irc)
    {
        char err[133],
            msg[133];

        sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
            irc, line, file);
        UF_get_fail_message(irc, err);

    /*  NOTE:  UF_print_syslog is new in V18 */

        UF_print_syslog(msg, FALSE);
        UF_print_syslog(err, FALSE);
        UF_print_syslog("\n", FALSE);
        UF_print_syslog(call, FALSE);
        UF_print_syslog(";\n", FALSE);

        if (!UF_UI_open_listing_window())
        {
            UF_UI_write_listing_window(msg);
            UF_UI_write_listing_window(err);
            UF_UI_write_listing_window("\n");
            UF_UI_write_listing_window(call);
            UF_UI_write_listing_window(";\n");
        }
    }

    return(irc);
}

#define WRITE(X)  UF_UI_open_listing_window(); UF_UI_write_listing_window(X)
#define WRITE_D(X) (write_integer_to_listing_window(#X, X))

static void write_integer_to_listing_window(char *title, int n)
{
    char
        msg[MAX_LINE_SIZE+1];

    UF_CALL(UF_UI_open_listing_window());
    sprintf(msg, "%s = %d\n", title, n);
    UF_CALL(UF_UI_write_listing_window(msg));
}

/*ARGSUSED*/
static int GTAC_const_cb(int dialog_id, void *client_data,
    UF_STYLER_item_value_type_p_t callback_data)
{
    UF_STYLER_item_value_type_t
        set_value;

    WRITE("Removing default action...\n");

/*  Set the default to the second button */
    set_value.item_attr = UF_STYLER_DEFAULT_ACTION;
    set_value.item_id = GTAC_ACTION_1;
    UF_CALL(UF_STYLER_set_value(dialog_id, &set_value));

/*  Make the second button invisible */
    set_value.item_attr = UF_STYLER_VISIBILITY;
    set_value.item_id = GTAC_ACTION_1;
    set_value.value.integer = FALSE;
    UF_CALL(UF_STYLER_set_value(dialog_id, &set_value));

/*  Work around for PR 4007701 - OK gets greyed out automatically */
    set_value.item_attr = UF_STYLER_SENSITIVITY;
    set_value.item_id = UF_STYLER_NAV_INDEX;
    set_value.subitem_index = UF_STYLER_OK_INDEX;
    set_value.value.integer = TRUE;
    UF_CALL(UF_STYLER_set_value(dialog_id, &set_value));
/*  End - Work around for PR 4007701 */

    return (UF_UI_CB_CONTINUE_DIALOG);
}

/*ARGSUSED*/
static int GTAC_action_0_act_cb(int dialog_id, void *client_data,
    UF_STYLER_item_value_type_p_t callback_data)
{
    WRITE("Pushed button...\n");

    return (UF_UI_CB_CONTINUE_DIALOG);
}

static void do_it(void)
{
    int
        resp;
    UF_STYLER_callback_info_t GTAC_cbs[3] = {
        {UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB  , 0, GTAC_const_cb},
        {GTAC_ACTION_0, UF_STYLER_ACTIVATE_CB, 0, GTAC_action_0_act_cb},
        {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }};

    UF_CALL(UF_STYLER_create_dialog("gtac.dlg", GTAC_cbs, 3, NULL, &resp));
    WRITE_D(resp);
}

/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
    if (UF_CALL(UF_initialize())) return;
    do_it();
    UF_terminate();
}

int ufusr_ask_unload(void)
{
    return (UF_UNLOAD_IMMEDIATELY);
}

------------------

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

flyer
Mitglied



Sehen Sie sich das Profil von flyer an!   Senden Sie eine Private Message an flyer  Schreiben Sie einen Gästebucheintrag für flyer

Beiträge: 48
Registriert: 10.07.2002

erstellt am: 27. Jun. 2003 15:22    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities

Erst einmal DANKE an "berberic",

kannst Du mir vielleicht auch die Frage beantworten,
ob man die Standart Schaltknöpfe (OK,Anwenden,Abbruch) eines UIStyler
Dialoges "ausblenden" kann ???
Dabei sei wieder angenommen, dass ich einen fertigen Styler-Dialog aus
einer DLL aufrufe.

Hintergrund : Ich schreibe meinen eigenen Knöpfe (OK & CANCEL). Derzeit schalte ich dann die Standart Button's auf sensitive.

Aber ich glaube, dass ich nicht so einfach.......

MfG

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

berberic
Mitglied
Software-Developer


Sehen Sie sich das Profil von berberic an!   Senden Sie eine Private Message an berberic  Schreiben Sie einen Gästebucheintrag für berberic

Beiträge: 113
Registriert: 04.02.2003

Don't worry be happy.
Michael

erstellt am: 27. Jun. 2003 23:53    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities Nur für flyer 10 Unities + Antwort hilfreich

Hallo flyer,

Es gibt im UG/Styler für die Dialogattribute eine Einstellung für
den Dialogfenstertyp (unten oder oben). Wenn dieses Attribut auf
oben eingestellt ist, dann verschwinden die Standard-Buttons. In
der Source-Template-Datei findest Du dann folgende Code-Fragmente:

/*--------------------------------------------------------------------------
UF_MB_styler_actions_t contains 4 fields.  These are defined as follows:

Field 1 : the name of your dialog that you wish to display.
Field 2 : any client data you wish to pass to your callbacks.
Field 3 : your callback structure.
Field 4 : flag to inform menubar of your dialog location.  This flag MUST 
          match the resource set in your dialog!  Do NOT ASSUME that changing
          this field will update the location of your dialog.  Please use the
          UIStyler to indicate the position of your dialog.
--------------------------------------------------------------------------*/
static UF_MB_styler_actions_t actions[] = {
    { "example.dlg",  NULL,  NULL,  UF_MB_STYLER_IS_TOP },
    { NULL,  NULL,  NULL,  0 } /* This is a NULL terminated list */
};

/*---------------- MENUBAR HOOKUP HELP Example -------------------
To launch this dialog from a Unigraphics menubar, you must follow
the steps below.
1)  Add the following lines to your MenuScript file in order to
    associate a menu bar button with your dialog.  In this   
    example, a cascade menu will be created and will be       
    located just before the Help button on the main menubar. 
    The button, UG_NEW_PART_BTN is set up to launch your dialog and
    will be positioned as the first button on your pulldown menu.
    If you wish to add the button to an existing cascade, simply
    add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU 
    to your menuscript file. 
   
    The MenuScript file requires an extension of ".men".
    Make sure that you add the extension to the file and place 
    the file in your startup directory:
      $UGII_USER_DIR/startup or
      $UGII_SITE_DIR/startup or
      $UGII_VENDOR_DIR/startup directory


    Move the contents between the dashed lines to your Menuscript file.
!  ----------------------------------------------------------------
    VERSION 120

    EDIT UG_GATEWAY_MAIN_MENUBAR

    BEFORE UG_HELP
      CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN
      LABEL Dialog Launcher
    END_OF_BEFORE

    MENU UISTYLER_DLG_CASCADE_BTN
      BUTTON UG_NEW_PART_BTN
      LABEL Display ug_new_part dialog
      ACTIONS ug_new_part.dlg
    END_OF_MENU
!  ---------------------------------------------------------------


2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta
  user exit as shown below.  To use this call, remove the conditional
  definitions:  #ifdef MENUBAR_COMMENTED_OUT
                #endif MENUBAR_COMMENTED_OUT
 
  The static structure, actions, will allow you to associate ALL of your
  dialogs and callback functions to the  menubar at once.  For example, if you
  wish to have 10 dialogs associated to 10 different buttons on the menubar,
  you may enter each dialog and callback list into the actions structure. Make
  sure that you have created a corresponding button in your MenuScript file.
 
  You may also have separate shared libraries, each with a ufsta user exit
  for each individual dialog.


3) Place your compiled and linked ufsta user function in
  $UGII_USER_DIR/startup or 
  $UGII_SITE_DIR/startup or
  $UGII_VENDOR_DIR/startup directory.   

  NOTE:  The user function must contain the proper extension .so, .sl or .dll
  to make ensure that it is recognized by the MenuScript.  If it does not
  have the proper extension, it will NOT be recognized by MenuScript.   


  The action name you have provided in your MenuScript must correspond to
  to the dialog name provided in the action structure.  This MUST match inorder
  to bind your dlg file to your MenuScript button.                           


4) Copy your UIStyler dialog file to the proper directory.
  All dialog files (.dlg) must be located in
      $UGII_USER_DIR/application or
      $UGII_SITE_DIR/application or
      $UGII_VENDOR_DIR/application directory


------------------------------------------------------------*/
#ifdef MENUBAR_COMMENTED_OUT
extern void ufsta (char *param, int *retcode, int rlen)
{
    int  error_code;

    if ( (UF_initialize()) != 0)
          return;
                                               
    if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )
    {
          char fail_message[133];
         
          UF_get_fail_message(error_code, fail_message);
          printf ( "%s\n", fail_message );
    }
                                               
    UF_terminate();                           
    return;
}
#endif /*MENUBAR_COMMENTED_OUT*/

Die Dokumentation zu diesem Attribut sagt folgendes aus:

Display Type

Indicates whether or not the dialog is to be in the top or bottom
position. If it's a top dialog, it cannot have any navigation
buttons and it can only be launched from the menubar.

Integer

FALSE

C

Ich selbst habe das noch nicht ausprobiert. aber wenn ich das
richtig interpretiere, dann muss Du deinen Dialog mit der Funktion
UF_MB_add_styler_actions innerhalb der ufsta Funktion als Callback
einrichten, damit die Standard-Buttons nicht angezeigt werden.

Ich wäre Dir sehr dankbar, wenn Du mich auf dem Laufenden halten
könntest. Auch ich will noch was dazulehren. Danke.

Gruß Michael

------------------

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Anzeige.:

Anzeige: (Infos zum Werbeplatz >>)

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen

nächster neuerer Beitrag | nächster älterer Beitrag
Antwort erstellen


Diesen Beitrag mit Lesezeichen versehen ... | Nach anderen Beiträgen suchen | CAD.de-Newsletter

Administrative Optionen: Beitrag schliessen | Archivieren/Bewegen | Beitrag melden!

Fragen und Anregungen: Kritik-Forum | Neues aus der Community: Community-Forum

(c)2023 CAD.de | Impressum | Datenschutz