exbutton - faq

How do you find the control's help / documentation on your computer:

  • Open the Run dialog on your Windows, and type exg2antt.chm, to run the exg2antt's help file. By default, the setup installs the CHM file into your system folder, so you can open the control's help / documentation by typing the control's name followed by .chm extension in the Run dialog box.
  • Locate and Run the ExG2antt.chm shortcut from the component's folder.
  • For How-To questions, you can run the ExHelper.exe shortcut located in the component's folder.
  • For How-To questions, you can locate and run the HOWTODO.chm shortcut from the component's folder.

Frequently Asked Questions - General

Click the programming language you use for general questions:

How-To Questions

Click the programming language you use for how-to questions:

Exontrol Software - ExButton FAQ page

Frequently Asked Questions - ExButton Component

Listed below are the questions that we are asked quite often. Before you write us, be sure to check here. 

Are you looking for something?

Just press CTRL+F ( or select Edit\Find menu item ) and you have a dialog that will help you to locate the string that are you looking for.

Where can I find the control's release notes?

The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link.

How to replace my old VB buttons with this new button?

Actually, replacing old VB Command buttons with the Exontrol's exButton component is just like replacing a string with another.  

You have the following options to replace the VB Command objects with the Exontrol's exButton component.

A) 

  • Make the first step to add the ExButton to the VB project like any control with the project open (Ctrl+T), save and close it.

  • Do the "VB.Command" search and replace in each frm file.

B)

  • Open the Project1.vbp and add a reference to the exbutton.dll by adding the line ~Object={65D9132C-B295-42A0-8421-B8B1DA27C5CE}#1.0#0; ExButton.dll~ Do not include the ~ characters.

  • Open the Form1.frm and add the ~Object = "{65D9132C-B295-42A0-8421-B8B1DA27C5CE}#1.0#0"; "ExButton.dll"~ reference to the form just before 'Begin VB.Form'

  • Replace all ~VB.CommandButton~ with the ~EXBUTTONLibCtl.Button~ and save the form1.frm file.

Now, the idea to replace the old VB button with the new button is to use a tool that's able to find and replace strings. For instance if you have multiple vbp files adding the object reference to the files could be like follows. Look for a property in the .vbp file that could be located in all your vbp files, like VersionCompanyName ( or whatever ) and do Replace('VersionCompanyName="YourCompanyName"', 'VersionCompanyName="YourCompanyName"\r\nObject={65D9132C-B295-42A0-8421-B8B1DA27C5CE}#1.0#0; ExButton.dll'. This way you actually added the reference to the project file. The same for the file reference in the frm files where the 'Begin VB.Form' could be located.

How do I assign a skin file to my button?

We assume that you have already a skin file ( else you can search for *.ebn files in the samples folder of the Exontrol's ExButton ). 

There are two options to load your skin file to the button using the Skin or FocusSkin method of the ExButton:

  • converting the skin file to a BASE64 encoded string.  
  • loading directly the file 

Converting the skin file to a BASE64 encoded string is possible using the Exontrol's ExImages tool. It is free to use, so you have to download it and to run the ExImages.exe file.

Open a Windows Explorer, locate your skin file and drag the file over the area "Drag here a file such of .... ". The tool generates the BASE64 encoded string in two formats: VB or Template. 

The VB format shows like follows:

and it can be copied and pasted to your VB, VC code.

The Template form looks like:

and it can be used in Template pages. Also, the tool displays the length of the string that's required to hold the file you dragged. Important to notice is that the ExImages tool compresses the file before generating the BASE64 encoded string, but converting it to a BASE64 string it means that the size of the string will be with 1/4 greater than compressed file. The BASE64 encoded strings are useful to hold your icons, pictures, skins in string instead adding all kind of files to your application.

So, after we get the BASE64 encoded string all that you need to do is to pass the s variable to Skin, or FocusSkin method like in the following sample:

 

The sample shows how to apply a skin to the exNormal state of the button. Using the same way you can assign skin for any state of the button, and you can assign skins for states  that you are going to use, not for all. For instance, if you have AllowHotState property is False, the exHot state should not be assigned ( because it is never used ). Also, if you have UseFocusSkin property on True, instead calling the Skin method you should call FocusSkin method. Also, if multiple skins are applied in the same time we would recommend using the the BeginUpdate and EndUpdate methods. You will find a simple sample bellow this page.

Loading directly the file is possible by passing the path to the skin file to the Skin or FocusSkin method like in the following sample:

With Button1
    .Skin exNormal, "D:\Exontrol\ExButton\project\skins\XPSilver\normal.ebn"
End With

Use the BeginUpdate and EndUpdate methods to avoid painting the button while adding skins for each state of the button like in the following sample:

With Button1
    .BeginUpdate
    
        Dim strPath As String
        strPath = "D:\Exontrol\ExButton\sample\VB\Builder\Predefined\XPSilver\"
        
        .UseFocusSkin = True
        .Skin exNormal, strPath + "normal.ebn"
        .Skin exHot, strPath + "hot.ebn"
        .Skin exPushed, strPath + "pushed.ebn"
        .FocusSkin exNormal, strPath + "focus.ebn"
    
    .EndUpdate
End With

How can I assign different skins for my buttons?

The Skin property assigns a different skin ( visual appearance ) for the button. The Skin property changes the visual appearance for all buttons the same Style property.  So, if you would like to have a different skin for buttons you need to have different values for the Style property like in the following sample:

How can I paint the EBN object directly on my form?

The EBN_DRAW registered message does the trick. Use the RegisterWindowMessage API function to get the identifier of the EBN_DRAW message. Send this message to the eXButton by passing, the state and the handle to the device context, and the clipping region will show the button's state.

The following VB sample shows how to print the eXButton's EBN object on the Form's background. Insert the eXButton component to a form, and use the following code:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long

Private Sub Form_Paint()
    Me.Cls
    SendMessage Form1.Button1.hwnd, RegisterWindowMessage("EBN_DRAW"), 0, ByVal Me.hwnd
End Sub

The following C++ sample shows how to print the eXButton's EBN object on the dialog's background. Insert the eXButton component to the form, and use the following code:

void OnPaint()
{
	CPaintDC dc(this); // device context for painting
	m_button.SendMessage( RegisterWindowMessage( _T("EBN_DRAW") ), 0, (LPARAM)dc.m_hDC );
}

The LPARAM parameter of the SendMessage API could be

  • HWND - a handle to a window where the EBN object should be painted

  • HDC - a handle to device context.

In both cases, the clipping region determines the area to show the EBN object, so you can use the SelectClipRgn API function to specify the area where the EBN object should be shown.

Copyright 1999-2017 Exontrol. All rights reserved.