FIFO view using an editorGadget?

Just starting out? Need help? Post your questions and find answers here.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Welcome to PB JElliott :)

Maybe I'm missing the point, but how about something like this...

Code: Select all

If OpenWindow(0, 0, 0, 400, 400, "FIFO EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
  EditorGadget(0, 5, 5, 390, 250) 
  ButtonGadget(1, 5, 300, 100, 25, "Add line") 
  For a = 1 To 100 
    AddGadgetItem(0, -1, "Line "+Str(a)) 
  Next 
  totalCount = 100 
  SendMessage_(GadgetID(0), #EM_SCROLLCARET, 0, 0)
  Repeat 
    event = WaitWindowEvent() 
    If event = #PB_Event_Gadget And EventGadget() = 1 
      totalCount + 1 
      AddGadgetItem(0, count-1, "Line " + Str(totalCount)) 
      SendMessage_(GadgetID(0), #EM_SCROLLCARET, 0, 0)
      SendMessage_(GadgetID(0), #EM_SCROLL, #SB_PAGEDOWN, 0)
      count = CountGadgetItems(0) 
      If  count > 100 
        RemoveGadgetItem(0, 0) 
      EndIf 
    EndIf 
  Until event = #PB_Event_CloseWindow 
EndIf 
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

I didn't think of just removing one line at a time from the editor. :oops:
JElliott
User
User
Posts: 16
Joined: Mon Sep 03, 2007 3:44 pm
Location: Connecticut, USA

Post by JElliott »

Sparkie - you aren't missing anything, this is precisely what I wanted to do - I have inserted it in my code and it works great!

My ignorance of the breadth of the available commands is my biggest hindrance right now. I want to thank both you and Derek for your quick responses.

Jeff E.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

You are very welcome. :)
JElliot wrote:My ignorance of the breadth of the available commands is my biggest hindrance right now
We have ALL been there at one time or another. Hell, I still miss the obvious every now and then. :lol:
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Sparkie wrote: I still miss the obvious every now and then. :lol:
I always seem to miss the obvious and try to find a far more awkward way, thank god for Sparkie, Netmaestro, Srod and all the others.
Post Reply