Loading ...
Sorry, an error occurred while loading the content.
 

Sample code to get control styles

Expand Messages
  • Stefan Pendl
    Hi, Below find an example, which lists all the styles applied to LB controls by default. As you will notice, the text editor and graphics control are custom
    Message 1 of 1 , Feb 7, 2011
      Hi,

      Below find an example, which lists all the styles applied to LB controls by default.

      As you will notice, the text editor and graphics control are custom classes, so this is the cause, why you can't interact with them
      through API functions.

      The commented styles are obsolete or a combination of other styles.

      Make sure to point the image for the BMPBUTTON to the Tic-Tac-Toe title image located inside the BMP folder of the LB installation
      or LB %APPDATA% folder.


      '---code start (watch for line wraps)
      array$(1) = "Test"

      statictext #main.check1, "Test", 10, 10, 100, 25
      textbox #main.check2, 120, 10, 100, 25
      listbox #main.check3, array$(), [dummy], 10, 40, 100, 25
      combobox #main.check4, array$(), [dummy], 120, 40, 100, 25

      ' buttons
      button #main.check5, "Test", [dummy], ul, 10, 70
      bmpbutton #main.check6, "TITLETTT.BMP", [dummy], ul, 120, 70
      checkbox #main.check7, "Test", [dummy], [dummy], 10, 100, 100, 25
      groupbox #main.check8, "Test", 120, 100, 100, 25
      radiobutton #main.check9, "Test", [dummy], [dummy], 10, 130, 100, 25

      ' LB custom controls
      texteditor #main.check10, 10, 160, 100, 45
      graphicbox #main.check11, 120, 160, 100, 45

      open "Get Control Styles" for window as #main
      #main "trapclose [main.quit]"

      for i = 1 to 11
      Handle$ = "#main.check"; i
      handle = hwnd(#Handle$)
      exStyle = GetWindowLong(handle, _GWL_EXSTYLE)
      Style = GetWindowLong(handle, _GWL_STYLE)
      Class$ = GetClassName$(handle)

      print
      print "Window Class: "; Class$
      print

      print "Extended Window Styles: ";
      if exStyle and _WS_EX_ACCEPTFILES then print "WS_EX_ACCEPTFILES ";
      if exStyle and _WS_EX_APPWINDOW then print "WS_EX_APPWINDOW ";
      if exStyle and _WS_EX_CLIENTEDGE then print "WS_EX_CLIENTEDGE ";
      if exStyle and hexdec("400") then print "WS_EX_COMPOSITED ";
      if exStyle and _WS_EX_CONTEXTHELP then print "WS_EX_CONTEXTHELP ";
      if exStyle and _WS_EX_CONTROLPARENT then print "WS_EX_CONTROLPARENT ";
      if exStyle and _WS_EX_DLGMODALFRAME then print "WS_EX_DLGMODALFRAME ";
      if exStyle and hexdec("80000") then print "WS_EX_LAYERED ";
      if exStyle and hexdec("400000") then print "WS_EX_LAYOUTRTL ";
      if exStyle and _WS_EX_LEFT then print "WS_EX_LEFT ";
      if exStyle and _WS_EX_LEFTSCROLLBAR then print "WS_EX_LEFTSCROLLBAR ";
      if exStyle and _WS_EX_LTRREADING then print "WS_EX_LTRREADING ";
      if exStyle and _WS_EX_MDICHILD then print "WS_EX_MDICHILD ";
      if exStyle and hexdec("8000000") then print "WS_EX_NOACTIVATE ";
      if exStyle and hexdec("100000") then print "WS_EX_NOINHERITLAYOUT ";
      if exStyle and _WS_EX_NOPARENTNOTIFY then print "WS_EX_NOPARENTNOTIFY ";
      if exStyle and _WS_EX_OVERLAPPEDWINDOW then print "WS_EX_OVERLAPPEDWINDOW ";
      if exStyle and _WS_EX_PALETTEWINDOW then print "WS_EX_PALETTEWINDOW ";
      if exStyle and _WS_EX_RIGHT then print "WS_EX_RIGHT ";
      if exStyle and _WS_EX_RIGHTSCROLLBAR then print "WS_EX_RIGHTSCROLLBAR ";
      if exStyle and _WS_EX_RTLREADING then print "WS_EX_RTLREADING ";
      if exStyle and _WS_EX_STATICEDGE then print "WS_EX_STATICEDGE ";
      if exStyle and _WS_EX_TOOLWINDOW then print "WS_EX_TOOLWINDOW ";
      if exStyle and _WS_EX_TOPMOST then print "WS_EX_TOPMOST ";
      if exStyle and _WS_EX_TRANSPARENT then print "WS_EX_TRANSPARENT ";
      if exStyle and _WS_EX_WINDOWEDGE then print "WS_EX_WINDOWEDGE ";
      print
      print

      print "Standard Window Styles: ";
      if Style and _WS_BORDER then print "WS_BORDER ";
      if Style and _WS_CAPTION then print "WS_CAPTION ";
      if Style and _WS_CHILD then print "WS_CHILD ";
      'if Style and _WS_CHILDWINDOW then print "WS_CHILDWINDOW ";
      if Style and _WS_CLIPCHILDREN then print "WS_CLIPCHILDREN ";
      if Style and _WS_CLIPSIBLINGS then print "WS_CLIPSIBLINGS ";
      if Style and _WS_DISABLED then print "WS_DISABLED ";
      if Style and _WS_DLGFRAME then print "WS_DLGFRAME ";
      if Style and _WS_GROUP then print "WS_GROUP ";
      if Style and _WS_HSCROLL then print "WS_HSCROLL ";
      if Style and _WS_ICONIC then print "WS_ICONIC ";
      if Style and _WS_MAXIMIZE then print "WS_MAXIMIZE ";
      if Style and _WS_MAXIMIZEBOX then print "WS_MAXIMIZEBOX ";
      'if Style and _WS_MINIMIZE then print "WS_MINIMIZE ";
      if Style and _WS_MINIMIZEBOX then print "WS_MINIMIZEBOX ";
      if Style and _WS_OVERLAPPED then print "WS_OVERLAPPED ";
      if Style and _WS_OVERLAPPEDWINDOW then print "WS_OVERLAPPEDWINDOW ";
      if Style and _WS_POPUP then print "WS_POPUP ";
      if Style and _WS_POPUPWINDOW then print "WS_POPUPWINDOW ";
      if Style and _WS_SIZEBOX then print "WS_SIZEBOX ";
      if Style and _WS_SYSMENU then print "WS_SYSMENU ";
      if Style and _WS_TABSTOP then print "WS_TABSTOP ";
      'if Style and _WS_THICKFRAME then print "WS_THICKFRAME ";
      'if Style and _WS_TILED then print "WS_TILED ";
      'if Style and _WS_TILEDWINDOW then print "WS_TILEDWINDOW ";
      if Style and _WS_VISIBLE then print "WS_VISIBLE ";
      if Style and _WS_VSCROLL then print "WS_VSCROLL ";
      print
      print

      print "Individual Control Styles: ";

      select case lower$(Class$)
      case "combobox"
      if Style and _CBS_AUTOHSCROLL then print "CBS_AUTOHSCROLL ";
      if Style and _CBS_DISABLENOSCROLL then print "CBS_DISABLENOSCROLL ";
      if Style and _CBS_DROPDOWN then print "CBS_DROPDOWN ";
      if Style and _CBS_DROPDOWNLIST then print "CBS_DROPDOWNLIST ";
      if Style and _CBS_HASSTRINGS then print "CBS_HASSTRINGS ";
      if Style and _CBS_LOWERCASE then print "CBS_LOWERCASE ";
      if Style and _CBS_NOINTEGRALHEIGHT then print "CBS_NOINTEGRALHEIGHT ";
      if Style and _CBS_OEMCONVERT then print "CBS_OEMCONVERT ";
      if Style and _CBS_OWNERDRAWFIXED then print "CBS_OWNERDRAWFIXED ";
      if Style and _CBS_OWNERDRAWVARIABLE then print "CBS_OWNERDRAWVARIABLE ";
      if Style and _CBS_SIMPLE then print "CBS_SIMPLE ";
      if Style and _CBS_SORT then print "CBS_SORT ";
      if Style and _CBS_UPPERCASE then print "CBS_UPPERCASE ";

      case "button"
      if Style and _BS_3STATE then print "BS_3STATE ";
      if Style and _BS_AUTO3STATE then print "BS_AUTO3STATE ";
      if Style and _BS_AUTOCHECKBOX then print "BS_AUTOCHECKBOX ";
      if Style and _BS_AUTORADIOBUTTON then print "BS_AUTORADIOBUTTON ";
      if Style and _BS_CHECKBOX then print "BS_CHECKBOX ";
      if Style and _BS_DEFPUSHBUTTON then print "BS_DEFPUSHBUTTON ";
      if Style and _BS_GROUPBOX then print "BS_GROUPBOX ";
      if Style and _BS_LEFTTEXT then print "BS_LEFTTEXT ";
      if Style and _BS_OWNERDRAW then print "BS_OWNERDRAW ";
      if Style and _BS_PUSHBUTTON then print "BS_PUSHBUTTON ";
      if Style and _BS_RADIOBUTTON then print "BS_RADIOBUTTON ";
      if Style and _BS_USERBUTTON then print "BS_USERBUTTON ";
      if Style and _BS_CENTER then print "BS_CENTER ";
      if Style and _BS_ICON then print "BS_ICON ";
      if Style and _BS_FLAT then print "BS_FLAT ";
      if Style and _BS_LEFT then print "BS_LEFT ";
      if Style and _BS_MULTILINE then print "BS_MULTILINE ";
      if Style and _BS_NOTIFY then print "BS_NOTIFY ";
      if Style and _BS_PUSHLIKE then print "BS_PUSHLIKE ";
      if Style and _BS_RIGHT then print "BS_RIGHT ";
      'if Style and _BS_RIGHTBUTTON then print "BS_RIGHTBUTTON ";
      if Style and _BS_TEXT then print "BS_TEXT ";
      if Style and _BS_TOP then print "BS_TOP ";
      if Style and hexdec("F") then print "BS_TYPEMASK ";
      if Style and _BS_VCENTER then print "BS_VCENTER ";
      if Style and hexdec("C") then print "BS_SPLITBUTTON ";
      if Style and hexdec("D") then print "BS_DEFSPLITBUTTON ";
      if Style and hexdec("E") then print "BS_COMMANDLINK ";
      if Style and hexdec("F") then print "BS_DEFCOMMANDLINK ";

      case "listbox"
      if Style and hexdec("8000") then print "LBS_COMBOBOX ";
      if Style and _LBS_DISABLENOSCROLL then print "LBS_DISABLENOSCROLL ";
      if Style and _LBS_EXTENDEDSEL then print "LBS_EXTENDEDSEL ";
      if Style and _LBS_HASSTRINGS then print "LBS_HASSTRINGS ";
      if Style and _LBS_MULTICOLUMN then print "LBS_MULTICOLUMN ";
      if Style and _LBS_MULTIPLESEL then print "LBS_MULTIPLESEL ";
      if Style and _LBS_NODATA then print "LBS_NODATA ";
      if Style and _LBS_NOINTEGRALHEIGHT then print "LBS_NOINTEGRALHEIGHT ";
      if Style and _LBS_NOREDRAW then print "LBS_NOREDRAW ";
      if Style and _LBS_NOSEL then print "LBS_NOSEL ";
      if Style and _LBS_NOTIFY then print "LBS_NOTIFY ";
      if Style and _LBS_OWNERDRAWFIXED then print "LBS_OWNERDRAWFIXED ";
      if Style and _LBS_OWNERDRAWVARIABLE then print "LBS_OWNERDRAWVARIABLE ";
      if Style and _LBS_SORT then print "LBS_SORT ";
      if Style and _LBS_STANDARD then print "LBS_STANDARD ";
      if Style and _LBS_USETABSTOPS then print "LBS_USETABSTOPS ";
      if Style and _LBS_WANTKEYBOARDINPUT then print "LBS_WANTKEYBOARDINPUT ";

      case "static"
      if Style and _SS_BITMAP then print "SS_BITMAP ";
      if Style and _SS_BLACKFRAME then print "SS_BLACKFRAME ";
      if Style and _SS_BLACKRECT then print "SS_BLACKRECT ";
      if Style and _SS_CENTER then print "SS_CENTER ";
      if Style and _SS_CENTERIMAGE then print "SS_CENTERIMAGE ";
      if Style and hexdec("2000") then print "SS_EDITCONTROL ";
      if Style and hexdec("4000") then print "SS_ENDELLIPSIS ";
      if Style and _SS_ENHMETAFILE then print "SS_ENHMETAFILE ";
      if Style and _SS_ETCHEDFRAME then print "SS_ETCHEDFRAME ";
      if Style and _SS_ETCHEDHORZ then print "SS_ETCHEDHORZ ";
      if Style and _SS_ETCHEDVERT then print "SS_ETCHEDVERT ";
      if Style and _SS_GRAYFRAME then print "SS_GRAYFRAME ";
      if Style and _SS_GRAYRECT then print "SS_GRAYRECT ";
      if Style and _SS_ICON then print "SS_ICON ";
      if Style and _SS_LEFT then print "SS_LEFT ";
      if Style and _SS_LEFTNOWORDWRAP then print "SS_LEFTNOWORDWRAP ";
      if Style and _SS_NOPREFIX then print "SS_NOPREFIX ";
      if Style and _SS_NOTIFY then print "SS_NOTIFY ";
      if Style and _SS_OWNERDRAW then print "SS_OWNERDRAW ";
      if Style and hexdec("8000") then print "SS_PATHELLIPSIS ";
      if Style and hexdec("40") then print "SS_REALSIZECONTROL ";
      if Style and _SS_REALSIZEIMAGE then print "SS_REALSIZEIMAGE ";
      if Style and _SS_RIGHT then print "SS_RIGHT ";
      if Style and _SS_RIGHTJUST then print "SS_RIGHTJUST ";
      if Style and _SS_SIMPLE then print "SS_SIMPLE ";
      if Style and _SS_SUNKEN then print "SS_SUNKEN ";
      if Style and _SS_TYPEMASK then print "SS_TYPEMASK ";
      if Style and _SS_WHITEFRAME then print "SS_WHITEFRAME ";
      if Style and _SS_WHITERECT then print "SS_WHITERECT ";
      if Style and hexdec("C000") then print "SS_WORDELLIPSIS ";

      case "edit"
      if Style and _ES_AUTOHSCROLL then print "ES_AUTOHSCROLL ";
      if Style and _ES_AUTOVSCROLL then print "ES_AUTOVSCROLL ";
      if Style and _ES_CENTER then print "ES_CENTER ";
      if Style and _ES_LEFT then print "ES_LEFT ";
      if Style and _ES_LOWERCASE then print "ES_LOWERCASE ";
      if Style and _ES_MULTILINE then print "ES_MULTILINE ";
      if Style and _ES_NOHIDESEL then print "ES_NOHIDESEL ";
      if Style and _ES_NUMBER then print "ES_NUMBER ";
      if Style and _ES_OEMCONVERT then print "ES_OEMCONVERT ";
      if Style and _ES_PASSWORD then print "ES_PASSWORD ";
      if Style and _ES_READONLY then print "ES_READONLY ";
      if Style and _ES_RIGHT then print "ES_RIGHT ";
      if Style and _ES_UPPERCASE then print "ES_UPPERCASE ";
      if Style and _ES_WANTRETURN then print "ES_WANTRETURN ";
      end select

      print
      print
      print "-----------------------------"
      next

      [dummy]
      wait

      [main.quit]
      close #main
      end

      function GetWindowLong(handle, index)
      calldll #user32, "GetWindowLongA", _
      handle as ulong, _
      index as ulong, _
      GetWindowLong as ulong
      end function

      function GetClassName$(handle)
      MaxCount = _MAX_PATH
      ClassName$ = space$(MaxCount)

      calldll #user32, "GetClassNameA", _
      handle as ulong, _
      ClassName$ as ptr, _
      MaxCount as ulong, _
      result as ulong

      GetClassName$ = left$(ClassName$, result)
      end function
      '---code end

      ---
      Stefan Pendl
      http://stefanpendl.runbasichosting.com/

      Liberty BASIC 4.04 Pro ... http://www.libertybasic.com/assist.html
      Liberty BASIC 4.04 ....... http://www.libertybasic.com/lb404setup.exe

      Liberty BASIC Bug Tracker ... http://libertybasicbugs.wikispaces.com/

      Books at http://www.lulu.com/ and http://www.amazon.com/
      Alyce Watson ... APIs for Liberty BASIC
      Carl Gundel .... Beginning Programming with Liberty BASIC

      Windows 7 Home Premium 64-bit RTM
      AMD Turion X2 RM-70 2GHz, 4GB RAM
    Your message has been successfully submitted and would be delivered to recipients shortly.