Difference between revisions of "Ide/Creating new Project Items/Creating a Toolbar"

From wiki.visual-prolog.com
(New page: <noinclude>Category:Ide</noinclude> The '''Toolbar''' editor allows you interactively create various kinds of toolbars. ==== Creating a Toolbar ==== To create and register a new tool...)
 
m (Category)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>[[Category:Ide]]</noinclude>
+
<noinclude>[[Category:Ide/Create New Project Items]]</noinclude>
The '''Toolbar''' editor allows you interactively create various kinds of toolbars.
+
== Creating a Toolbar ==
 
+
To create and register a new toolbar in a project you need to use the '''File | New''' menu command. In the opened '''Create Project Item''' dialog you should select in the left pane the '''Toolbar''' type of created item. Then the dialog will accept the following shape:
==== Creating a Toolbar ====
 
 
 
To create and register a new toolbar in a project you need to use the '''File | New''' menu command. In the opened '''Create Project Item''' dialog you should select in the left pane the '''Toolbar''' type of created item. Then the dialog will accept the following shape:
 
 
 
===== New Toolbar Dialog =====
 
  
 
[[Image:Ide_MyToolbar_New.png]]
 
[[Image:Ide_MyToolbar_New.png]]
Line 16: Line 11:
 
:You should check one of the '''New Package''' or '''Existing Package''' radio buttons to specify whether the generated resource file and class, which handle the toolbar, will be included to the new package that will be created or will be included to the existing one.
 
:You should check one of the '''New Package''' or '''Existing Package''' radio buttons to specify whether the generated resource file and class, which handle the toolbar, will be included to the new package that will be created or will be included to the existing one.
  
:If you check the '''New Package''' radio button, then you should type in the directory name in the '''Parent Directory''' field; it is <vpbnf>(<TaskWindow>\)</vpbnf> in the picture. The package and the toolbar handling files will be created and placed into the parent directory.
+
:If you check the '''New Package''' radio button, then you should type in the directory name in the '''Parent Directory''' field; it is <vp>(TaskWindow\)</vp> in the picture. The package and the toolbar handling files will be created and placed into the parent directory.
  
:If you check the '''Existing Package''' radio button, then in the '''Package''' list button you should select one of the packages known to the project (the '''TaskWindow.pack''' in the picture). The files handling the created toolbar will be included into this package. The created files will be placed into the selected package subdirectory. The name of this subdirectory is displayed after the package name; it is <vpbnf>(<TaskWindow>\)</vpbnf> in the picture.
+
:If you check the '''Existing Package''' radio button, then in the '''Package''' list button you should select one of the packages known to the project (the '''TaskWindow.pack''' in the picture). The files handling the created toolbar will be included into this package. The created files will be placed into the selected package subdirectory. The name of this subdirectory is displayed after the package name; it is <vp>(TaskWindow\)</vp> in the picture.
  
===== Toolbar Attributes Dialog =====
+
=== Toolbar Attributes Dialog ===
  
 
After you press the '''OK''' button in the '''Create Project Item''' dialog, the '''Toolbar Attributes''' dialog appears.
 
After you press the '''OK''' button in the '''Create Project Item''' dialog, the '''Toolbar Attributes''' dialog appears.
Line 73: Line 68:
  
 
After clicking the '''OK''' button the new toolbar will be created and its name will be added to the existing toolbars for the current project. You can always go back and wake up the '''Toolbar Attributes''' dialog (with the '''Resource | Attribute''' task menu item or with the '''Attribute''' item from pop up menu) for the toolbar to change any of the toolbar attributes.
 
After clicking the '''OK''' button the new toolbar will be created and its name will be added to the existing toolbars for the current project. You can always go back and wake up the '''Toolbar Attributes''' dialog (with the '''Resource | Attribute''' task menu item or with the '''Attribute''' item from pop up menu) for the toolbar to change any of the toolbar attributes.
 
==== Editing a Toolbar ====
 
 
To edit a toolbar, double-click (or press '''Enter''') the name of a file with a toolbar description in the project tree in the '''Project''' window's list of project files. The '''Toolbar Editor''' window appears and you can create whatever form of a toolbar you wish.
 
 
[[Image:Ide_ToolbarEditor.png|center|frame|The '''Toolbar Editor''']]
 
 
In the top of the picture you see edited toolbar ('''ProjectToolbar''' in the picture).
 
 
===== Controls Toolbar =====
 
 
In the bottom of the previous picture you see the '''[Controls_Toolbar_in_the_Toolbar_Editor.htm Controls]''' toolbar. Using the '''[Controls_Toolbar_in_the_Toolbar_Editor.htm Controls]''' toolbar you can easily add desired controls into the edited toolbar.
 
 
===== Control Types Used in Toolbars =====
 
 
In the lower part of the previous picture we see the '''[Controls_Toolbar_in_the_Toolbar_Editor.htm Controls]''' toolbar, which contains all kinds of controls that can be used in toolbars.
 
 
{|{{prettytable}}
 
|-
 
! width="30%"|Control
 
! width="70%"|Description
 
|-
 
| '''Push Button'''
 
| This is a standard push button. When pressed it sends an <vp>vpiDomains::e_Menu</vp> event to the parent window. The bitmap must be registered for the button.
 
|-
 
| '''Check Button'''
 
| This is used to indicate the state of a property that can have two states; either checked or unchecked. When pressed it sends an <vp>vpiDomains::e_Control(_, vpiDomains::wc_CheckBox,_,_)</vp> event to the parent window. You must register a bitmap for a check button.
 
|-
 
| '''List Button'''
 
| A list button can be used to select one item from a number of values. When pressed it sends an <vp>vpiDomains::e_Control(_, vpiDomains::wc_LBoxButton,_,_)</vp> event to the parent window.
 
|-
 
| '''Static Text'''
 
| Text may be placed in this control initially and also dynamically. A '''Static Text''' is often used for titles.
 
|-
 
| '''Context Sensitive Text'''
 
| If a Context Sensitive Text field is put into the toolbar, this field will display help information about the control the mouse is currently located over.
 
|-
 
| '''Separator'''
 
| A separator is like a space; it is used to make some space and a vertical bar between other controls, usually to divide them into functional groups.
 
|-
 
| '''New Row'''
 
| New row is relevant only for toolbars with the styles '''Inside''' and '''Movable'''. A New Row control will cause the current line to break, and the following controls to appear on the next line of the toolbar.
 
|}
 
 
===== Toolbar Layout Editing =====
 
 
The layout of the toolbar can be done both with the keyboard, and with the mouse. There is an insertion point that is marked with a colored bar. This insertion point can be moved with the arrow keys, or by clicking the mouse on the new location. When the insertion bar is at a given location, the control to the right of the bar can be deleted by pressing the '''Delete''' key, the control to the left can be deleted by pressing the '''Backspace''' key.
 
 
To place a new control at the insertion point:
 
 
* select an item from the '''Controls''' menu or
 
* choose a control from the ones shown in the '''Controls''' floating dialog or
 
* click the right mouse button anywhere in the Toolbars Editor window area outside the toolbar to display a pop up from which a desired control can be selected.
 
 
===== Attributes of Toolbar Controls =====
 
 
After a control is inserted, it is possible to change the control attributes. Just double-click the control.
 
 
====== Push and Check Button Attributes ======
 
 
Double-click a Push button or a Check button calls the '''Button Attributes''' dialog.
 
 
[[Image:Ide_Toolbar_ButtonAttributes.png|center|frame|'''Specifying properties of push buttons and check buttons''']]
 
 
The following information must be specified:
 
 
{|{{prettytable}}
 
|-
 
| width="30%"|'''Constant'''
 
| width="70%"|A constant name to identify the button control. This is the constant that will be used in the <vp>vpiDomains::e_Menu</vp> events. Therefore, it is recommended to use the same constant as is used for the menu item correspondent to the same command.
 
 
The '''Constant''' input box is where you can select or type in the symbolic constant that will be used as the control identifier. It can be input directly from the keyboard or selected from the list of available constants (by clicking the [[Image:Ide_ListButton_Button.png]] button). It must be either a legal symbolic constant (for example, '''''idt_file_open''''' ) or an integer value.
 
 
If you enter a symbolic constant, then the IDE automatically places this symbolic constant into the '''resourceidentifiers.i''' file and generates an appropriate integer value for it. The '''Toolbar Editor''' automatically generates the default symbolic constants (for example, '''''idt_7''''' from the ''toolbar constant prefix'' '''''idt_''''' and the number of this control in the toolbar.
 
|-
 
| '''Status Text'''
 
|The string entered into this field can consist from 2 sub-strings separated by a semicolon. The sub-string specified before the semicolon (if specified) is used as the button Tool Tip text. The sub-string specified after the semicolon (or if the semicolon is not specified) will be displayed in the '''Context Sensitive Text''' field (when the mouse cursor is positioned over this button).
 
 
For example, the text '''''New;New file''''' will cause '''New''' to be shown in the yellow tool tip while '''New file''' will be shown in a context sensitive field when the mouse is over the button.
 
|-
 
|'''Checked'''
 
|If this check box is checked than the button initial state is "pressed" and the icon shaped as <span>''pressed''</span> is initially displayed. Otherwise the button initial state is "released" and the icon shaped as ''released'' is displayed.
 
|-
 
|'''Disabled'''
 
|If this check box is checked then the button initially does not accept a user input and is grayed. Otherwise the button is initially enabled (accepts a user input) and has initial state specified by the '''Checked''' check box.
 
|-
 
|'''Push Button'''<br /> or<br /> '''Check Button'''
 
|Select the appropriate button style ('''Push Button''' or '''Check Button'''). The style can be changed at any time. At runtime the state (''pressed'' or ''released'') of a check button can be switched by clicking the check button.
 
|-
 
|'''Bitmap Name'''
 
|This bitmap will be used to display a button. This bitmap should be selected from the list of bitmaps registered in the '''Project''' window (by clicking the [[Image:_Ide_ListButton_Button.png]] button). Before a bitmap name will appear in the registered bitmap list, it should be registered in the project with the '''File | Add''' command (the '''Resource Files''' should be selected in the '''Files of Type''').
 
 
In Visual Prolog v.7 we use a single bitmap for each button and automatically draw different state ornamentations for the ''released'' state, the ''pressed'' state, and the ''disabled'' state of the button.
 
|-
 
|'''Edit'''
 
|If the '''Edit''' button is pressed, then the [Graphics_Editor.htm Graphics editor] will come up with the given bitmap allowing you to view and edit the bitmap.
 
|}
 
 
====== Text Control Attributes ======
 
 
Double-clicking a Static Text or a Context Sensitive Text control calls the '''Text Attributes''' dialog:
 
 
[[Image:Ide_Toolbar_TextControl.png|center|frame|'''Specifying properties of text controls in a toolbar''']]
 
 
The following information must be specified:
 
 
{|{{prettytable}}
 
|-
 
| width="30%"|'''Constant'''
 
| width="70%"|A constant name to identify the Text control.
 
|-
 
| '''Initial Text'''
 
| The default text to display in the field.
 
|-
 
| '''Static'''<br />or<br />'''Context Sensitive'''
 
| Select the appropriate text control type. The style can be changed at any time.
 
|-
 
| '''Font '''
 
| Select a font name, font style (Normal, Bold, Italic ...), and font size for the displayed text.
 
|-
 
| '''Text Width'''
 
| Determines a width in pixels of the Text control field. It can be entered manually or, by pushing the '''"<nowiki>|</nowiki><---Text---><nowiki>|</nowiki>"''' button. In this case the width of the field will be optimized to display the '''Initial Text''' with the selected Font.
 
|-
 
| '''Foreground Color'''
 
| Select the Foreground Color for the displayed text.
 
|}
 
 
====== List Button Attributes ======
 
 
Double-clicking a List Button control calls the '''List Button Attributes''' dialog.
 
 
[[Image:Ide_Toolbar_ListButtonAttributes.png|center|frame|'''Specifying properties of list buttons in a toolbar''']]
 
 
Only two parameters can be set for a list button in a toolbar:
 
 
{|{{prettytable}}
 
|-
 
| width="30%"|'''Constant '''
 
| width="70%"|A constant name to identify the List Button control.
 
|-
 
| '''Width '''
 
| Determines the width in pixels of the List Button control field.
 
|}
 

Latest revision as of 16:18, 13 June 2013

Creating a Toolbar

To create and register a new toolbar in a project you need to use the File | New menu command. In the opened Create Project Item dialog you should select in the left pane the Toolbar type of created item. Then the dialog will accept the following shape:

Ide MyToolbar New.png

Name

In the Name field you should type in the name, which will be associated with this toolbar in the automatically generated code. This name should be a correct Visual Prolog name. It should be any sequence of letters, digits, and underscores, beginning with a letter. This name appears in names of files generated for handling the toolbar. These files appear in the project tree in the Project window. The Code Expert uses this name for generation of the name of class, which handle the toolbar.

Package

You should check one of the New Package or Existing Package radio buttons to specify whether the generated resource file and class, which handle the toolbar, will be included to the new package that will be created or will be included to the existing one.
If you check the New Package radio button, then you should type in the directory name in the Parent Directory field; it is (TaskWindow\) in the picture. The package and the toolbar handling files will be created and placed into the parent directory.
If you check the Existing Package radio button, then in the Package list button you should select one of the packages known to the project (the TaskWindow.pack in the picture). The files handling the created toolbar will be included into this package. The created files will be placed into the selected package subdirectory. The name of this subdirectory is displayed after the package name; it is (TaskWindow\) in the picture.

Toolbar Attributes Dialog

After you press the OK button in the Create Project Item dialog, the Toolbar Attributes dialog appears.

Ide ToolbarAttributes.png

The possible settings for a toolbar are:

Style

There are several toolbar styles. And since the layout of a toolbar simply shows the order of the controls it is easy to change the toolbar style.
The toolbar Style can be one of the following:
Toolbar Style Toolbar Location
Top Placed at the top of window
Left Placed at the left side of the window
Bottom Placed at bottom of window
Right Placed at the right side of the window
Inside Placed at a fixed location inside the window. (The Graphics Editor uses several of these)
Movable A floating toolbar, which the user can move around
Try to change the toolbar style to see the various layouts.

Title

Sets the title for the toolbar. It is disabled for all toolbar styles except for the Movable.

Position

Shows the toolbar position. The position can be set for the Inside and Movable toolbar styles.

Code

This group box contains the read only Class Name text field and the Update Code push button.
  • Class Name
    In this read-only control you can see the name of the class in which the IDE places the default code for the toolbar.
  • Update Code
    Click this push button to enforce code updating.

After clicking the OK button the new toolbar will be created and its name will be added to the existing toolbars for the current project. You can always go back and wake up the Toolbar Attributes dialog (with the Resource | Attribute task menu item or with the Attribute item from pop up menu) for the toolbar to change any of the toolbar attributes.