Textgadget with history of entries?

Just starting out? Need help? Post your questions and find answers here.
matalog
Enthusiast
Enthusiast
Posts: 165
Joined: Tue Sep 05, 2017 10:07 am

Textgadget with history of entries?

Post by matalog »

Is there a gadget or a way to use Textgadget, that will result in it remembering the last few entries and allowing them to be accessed via a dropdown selection area?

Like when you click on a text entry area in a web browser, this commonly happens, letting you quickly choose something that you have entered previously.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Textgadget with history of entries?

Post by idle »

Combobox ?

Code: Select all

If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ComboBoxGadget(0, 10, 10, 250, 21, #PB_ComboBox_Editable)
  AddGadgetItem(0, -1, "ComboBox 0")
  AddGadgetItem(0, -1, "ComboBox 1")
  AddGadgetItem(0, -1, "ComboBox 2")
  SetGadgetState(0, 2)
  Repeat : Until WaitWindowEvent()= #PB_Event_CloseWindow
EndIf

User avatar
spikey
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Textgadget with history of entries?

Post by spikey »

Idle got there first, but with edits too...

Code: Select all

#KbdReturn = 1

Define.S Entry

If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ComboBoxGadget(0, 10, 10, 250, 21, #PB_ComboBox_Editable)
  AddGadgetItem(0, -1, "Historical item 1")
  AddGadgetItem(0, -1, "Historical item 2")
  AddGadgetItem(0, -1, "Historical item 3")
  
  SetGadgetState(0, 0)
  
  AddKeyboardShortcut(0, #PB_Shortcut_Return, #KbdReturn)
  
  Repeat : 
    Event = WaitWindowEvent()
    If Event = #PB_Event_Menu And EventMenu() = #KbdReturn
      Entry = GetGadgetText(0)
      AddGadgetItem(0, 0, Entry)
      SetGadgetState(0, 0)
    EndIf
    
  Until Event = #PB_Event_CloseWindow
EndIf
AZJIO
Addict
Addict
Posts: 1318
Joined: Sun May 14, 2017 1:48 am

Re: Textgadget with history of entries?

Post by AZJIO »

viewtopic.php?t=79076

But I don't understand how to do it in the main menu. It is necessary to generate a list and attach the generated menu to a certain item of the main menu.
matalog
Enthusiast
Enthusiast
Posts: 165
Joined: Tue Sep 05, 2017 10:07 am

Re: Textgadget with history of entries?

Post by matalog »

Great, thanks guys, sorted now.
Post Reply