Source

vlocity-vinstall-gambas / Vlocity / MdlObjSizer.module

' Gambas module file

'    This file is part of vinstall-ng

'    vinstall-ng is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 2 of the License, or
'    (at your option) any later version.

'    vinstall-ng  is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with vinstall-ng.  If not, see <http://www.gnu.org/licenses/>.



PUBLIC fvirtfrm AS Form
PUBLIC datemp AS DrawingArea
PUBLIC SUB get_object_width(sText AS String) AS Integer 
   
   DIM iRetVal AS Integer 

  fvirtfrm = NEW Form 
  WITH fvirtfrm 
    .Width = 300 
    .Height = 200 
  END WITH  
  datemp = NEW DrawingArea(fvirtfrm) 
   
  Draw.Begin(datemp) 
  iRetVal = Draw.RichTextWidth(sText) 
  Draw.End 
  'fvirtfrm.Close
  RETURN iRetVal
   
   
END