Jump to content
  • entries
    943
  • comments
    5,899
  • views
    924,382

More Widgets


Josh

3,731 views

 Share

The combobox and listbox widget scripts are now updated. The combobox is presently using a more game-like style that jus shows the currently selected item. You can change the selection by clicking on the widget with the mouse, pressing keyboard keys, or scrolling the mouse wheel.

 

The listbox includes a slider that automatically appears when needed. In order to make rendering faster, the draw function calculates the first and last visible items, and only iterates through those items while drawing. That means that whether the list contains ten items or 1000, it will render at the exact same speed.

 

I have not yet figured out how to handle holding the mouse to continue scrolling the slider, since there is no MouseRepeat event in Windows (and probably not in Linux either).

 

 

You can get this update now on the beta branch on Steam.

  • Upvote 4
 Share

10 Comments


Recommended Comments

Oh, that was just testing. No images are used. There's a DrawPolygon() function I used for the arrows.

Link to comment

how to initialize gui?, this draws a button all over my screen (with a small text)

 

--Create a GUI
local gui = GUI:Create(context)

--Create a new widget
local button = Widget:Create(20,20,300,50,gui:GetBase())

--Set the widget's script to make it a button
button:SetScript("Scripts/GUI/Button.lua")

--Set the button text
button:SetText("Button")

Link to comment

In my MFC control I'm using the system's double-click time as base in a timer. The interval between the first and second call is longer than the subsequent calls.

Link to comment
    while EventQueue:Peek() do
       local event = EventQueue:Wait()
       if event.id == Event.WidgetAction then
           System:Print("WidgetAction")
       elseif event.id == Event.WidgetSelect then
           System:Print("WidgetSelect")
       end
   end

Link to comment

How do you check which widget sent the event? Trying to get something simple but usable for my game entry...

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...