Toggle bitmap button on .res file



  • Hello,

    Is it possible to create a toggle bitmap button using only the .res file?
    I tried with the GetDDescription function its work well, but when I use .res file this doesn't work.
    Also, when I use the FORCE_SIZE on .res file I get an error.

    BITMAPBUTTON BUTTON_ID
    {
        TOGGLE;
        BUTTON;
        FORCE_SIZE 16;
        ICONID1 5160;
        ICONID2 5159;
    }
    

    Thanks



  • hi,

    something like this will work as you expect (i hope)
    The trick is to create a two columns group and a dummy statictext so the button will have the "right" size.

    	GROUP
    		{
    			COLUMNS  2;
    
    			BITMAPBUTTON BUTTON_ID
    			{
    
    				SIZE 32;
    			    TOGGLE;
    			    BUTTON;
    			    ICONID1 5160;
    			    ICONID2 5159;
    			}
    			STATICTEXT { DUMMY; }
    		}
    

    One side effect is the icon will not be centered. You can see on this thread why.

    Cheers,
    Manuel



  • hi @m_magalhaes,

    Thank you much, that works.

    I have an another question concerning Description Resource, I don't know if I post it here or I must create a new post.

    Here is the code:

    GROUP
    {
        REAL MYOBJECT_PITCH { UNIT DEGREE; CUSTOMGUI REALSLIDER; MIN -360; MAX 360; STEP 1; }
        BITMAPBUTTON MYOBJECT_STRAIGHTEST_PITCH
        {
            SIZE 16;
            BUTTON;
            ALIGN_LEFT;
            ICONID1 5160;
        }
    
        REAL MYOBJECT_ROTATION { UNIT DEGREE; CUSTOMGUI REALSLIDER; MINSLIDER -90; MAXSLIDER 270; STEP 1; }
        STATICTEXT { JOINENDSCALE; }
    }
    

    And here screenshot of what I want to do:
    puch_icon_right.jpg
    Thanks



  • hi,

    Group is the key in UI. Simply add a SCALE_H; property for your slider. so for that two columns group, the slider will take all the place minus the button.

    	GROUP
    		{
    			COLUMNS  2;
    			REAL ONEFLOAT { CUSTOMGUI REALSLIDER; SCALE_H;}
    			BITMAPBUTTON BUTTON_ID
    			{
    
    				SIZE 16;
    			    TOGGLE;
    			    BUTTON;
    			    ICONID1 5160;
    			    ICONID2 5159;
    			}
    		}
    

    Cheers,
    Manuel


Log in to reply