1. Hi,

    I'm very inexperienced with programming, but I really enjoy this, so I plow on :)

    I have a frame, called a bubble:

    local bubble = CreateFrame("Frame")

    I then create other frames on this frame, like the background & the close button etc:

     -- BACKGROUND
     bubble.BG = bubble:CreateTexture(nil,"BACKGROUND")
     bubble.BG:SetTexture(0,0,0,0.7)
     bubble.BG:SetAllPoints(bubble)
    
     -- CLOSE BUTTON
     bubble.CloseButton = CreateFrame("Button","$parentCloseButton",bubble,"UIPanelCloseButton")
     bubble.CloseButton:SetWidth(25)
     bubble.CloseButton:SetHeight(25)
     bubble.CloseButton:SetPoint("TOPRIGHT",bubble,"TOPRIGHT",-2,-2)
    

    So now I come to the really difficult part... :( I want to create a scrolling message pane, like a chat pane, inside this bubble frame. I found the example on this exact site, pretty much hand-feeding me what I need to know: Your text to link here... & I'm so inexperienced I don't really know how to make it work.

    Up to this point I had my bubble frame working. It would pop up, with a dark texture & a little close button. But I cut & pasted code & really had no clue what I was doing. This is what I ended up with:

     bubble.PreviewFrame = CreateFrame("ScrollFrame", "FPreviewFrame") -- fp
    
     bubble.ScrollFrame = CreateFrame("ScrollingMessageFrame", "FPreviewSC") -- fpsc
    
     bubble.Slider = CreateFrame("Slider", "FPreviewScrollBar", bubble.PreviewFrame) -- fpsb
    
     -- Set up internal textures for the scrollbar, background and thumb texture
    
        bubble.Slider.bg = bubble.Slider:CreateTexture(nil, "BACKGROUND")
        bubble.Slider.bg:SetAllPoints(true)
        bubble.Slider.bg:SetTexture(0, 0, 0, 0.5)
    
        bubble.Slider.thumb = bubble.Slider:CreateTexture(nil, "OVERLAY")
        bubble.Slider.thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
        bubble.Slider.thumb:SetSize(25, 25)
        bubble.Slider:SetThumbTexture(bubble.Slider.thumb)
    
     -- This is the font used for the messages?   
    
        bubble.MessageFont = bubble.ScrollFrame:CreateFontString(nil,nil,"GameFontNormal") -- fs
    
     -- This changes the padding between font strings vertically
     local PADDING = 5
    
     -- Store the max width and overall height of the scroll child
     local height = 0
     local width = 0
    
     --height = bubble.ScrollFrame:GetNumMessages() * bubble.MessageFont:GetStringHeight()
     height = 500
    
     -- Set the size of the scroll child
     bubble.ScrollFrame:SetSize(BubbleSettings.BubbleWidth, height)
    
     -- Size and place the parent frame, and set the scrollchild to be the
     -- frame of font strings we've created
     bubble.PreviewFrame:SetSize(width, BubbleSettings.BubbleHeight)
     bubble.PreviewFrame:SetPoint("CENTER", UIParent, 0, 0)
     bubble.PreviewFrame:SetScrollChild(bubble.ScrollFrame)
     bubble.PreviewFrame:Show()
    
     --bubble.ScrollFrame:SetSize(width, height)
    
     -- Set up the scrollbar to work properly
     local scrollMax = height - BubbleSettings.BubbleHeight
     bubble.Slider:SetOrientation("VERTICAL");
     bubble.Slider:SetSize(16, BubbleSettings.BubbleHeight)
     bubble.Slider:SetPoint("TOPLEFT", bubble.PreviewFrame, "TOPRIGHT", 0, 0)
     bubble.Slider:SetMinMaxValues(0, scrollMax)
     bubble.Slider:SetValue(0)
     bubble.Slider:SetScript("OnValueChanged", function(self)
           Bubble.PreviewFrame:SetVerticalScroll(self:GetValue())
     end)
    
     -- Enable mousewheel scrolling
     bubble.PreviewFrame:EnableMouseWheel(true)
     bubble.PreviewFrame:SetScript("OnMouseWheel", function(self, delta)
           local current = bubble.Slider:GetValue()
    
           if IsShiftKeyDown() and (delta > 0) then
              bubble.Slider:SetValue(0)
           elseif IsShiftKeyDown() and (delta < 0) then
              bubble.Slider:SetValue(scrollMax)
           elseif (delta < 0) and (current < scrollMax) then
              bubble.Slider:SetValue(current + 20)
           elseif (delta > 0) and (current > 1) then
              bubble.Slider:SetValue(current - 20)
           end
     end)
    

    Needless to say it doesn't work :( I know I've really butchered the code from the link. I'm very lost. I really want it to be a scrolling message frame that I can add lines to with :AddMessage, & everything needs to be derived from this original 'bubble' frame.

    Is this even possible to do? Thanks for taking the time to read this :D

    So I have the very basic code worked out a little bit. I create a 'bubble' frame that looks like this:

    My Bubble

    I tried to cut & paste together from the dynamic scroll frame example on the 'snippets' page. It gave the the visible scroll frame, but I definitely didn't do something right. I want to be able to add messages to the scrollable inner frame using MessageFrame:AddMessage(). I also wanted to set the insert mode to the bottom of the scroll frame somehow. But I kept getting errors when I tried to call bubble.ScrollFrame:SetInsertMode("BOTTOM")

    This is what I was going for:

    what i want it to do

    This is the pieced together code to get this far... Can someone fill in the blanks on how I can get to the 2nd picture? :D

     bubble.PreviewFrame = CreateFrame("ScrollFrame",nil,bubble) -- fp      
     bubble.ScrollFrame = CreateFrame("ScrollingMessageFrame",nil,bubble) -- fpsc
     bubble.ScrollFrame:SetMaxLines(1000)
     bubble.ScrollFrame:SetInsertMode("BOTTOM")
    
     -- This is the font used for the messages?   
    
     bubble.ScrollFrame.MessageFont = bubble.ScrollFrame:CreateFontString(nil,nil,"GameFontNormal") -- fs
    
     bubble.Slider = CreateFrame("Slider",nil, bubble.PreviewFrame) -- fpsb
    
     -- Set up internal textures for the scrollbar, background and thumb texture
    
        bubble.Slider.bg = bubble.Slider:CreateTexture(nil, "BACKGROUND")
        bubble.Slider.bg:SetAllPoints(true)
        bubble.Slider.bg:SetTexture(0, 0, 0, 0.7)
    
    
    
        bubble.Slider.thumb = bubble.Slider:CreateTexture(nil, "OVERLAY")
        bubble.Slider.thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
        bubble.Slider.thumb:SetSize(25, 25)
        bubble.Slider:SetThumbTexture(bubble.Slider.thumb)
    
    
    
     -- This changes the padding between font strings vertically
     local PADDING = 5
    
     -- Store the max width and overall height of the scroll child
     local height = 0
     local width = 0
    
     height = bubble.ScrollFrame:GetNumMessages() * bubble.MessageFont:GetStringHeight()
     width = bubble:GetWidth     
    
     -- Set the size of the scroll child
     bubble.ScrollFrame:SetSize(width, height)
    
     -- Size and place the parent frame, and set the scrollchild to be the
     -- frame of font strings we've created
     bubble.PreviewFrame:SetSize(BubbleSettings.BubbleWidth, BubbleSettings.BubbleHeight)
     bubble.PreviewFrame:SetPoint("CENTER", bubble)
     bubble.PreviewFrame:SetScrollChild(bubble.ScrollFrame)
     bubble.PreviewFrame:Show()
    
     bubble.ScrollFrame:SetSize(BubbleSettings.BubbleWidth, BubbleSettings.BubbleHeight)
    
     -- Set up the scrollbar to work properly
     local scrollMax = height - BubbleSettings.BubbleHeight
     bubble.Slider:SetOrientation("VERTICAL");
     bubble.Slider:SetSize(16, BubbleSettings.BubbleHeight-20)
     bubble.Slider:SetPoint("TOPRIGHT", bubble.PreviewFrame, "TOPRIGHT",-10,-10)
     bubble.Slider:SetMinMaxValues(0, scrollMax)
     bubble.Slider:SetValue(scrollMax)
     bubble.Slider:SetScript("OnValueChanged", function(self)
           bubble.PreviewFrame:SetVerticalScroll(self:GetValue())
     end)
    
     -- Enable mousewheel scrolling
     bubble.PreviewFrame:EnableMouseWheel(true)
     bubble.PreviewFrame:SetScript("OnMouseWheel", function(self, delta)
           local current = bubble.Slider:GetValue()
    
           if IsShiftKeyDown() and (delta > 0) then
              bubble.Slider:SetValue(0)
           elseif IsShiftKeyDown() and (delta < 0) then
              bubble.Slider:SetValue(scrollMax)
           elseif (delta < 0) and (current < scrollMax) then
              bubble.Slider:SetValue(current + 20)
           elseif (delta > 0) and (current > 1) then
              bubble.Slider:SetValue(current - 20)
           end
     end)
    

    You're actually not doing anything wrong that I can see. There's a bug right now with SetInsertMode.. so just don't call that function. I'm trying to get it fixed, but there's still a problem with it.

    Wen you take that out, do things work for you?

    Hi thanks for the reply!

    Nope, when i comment out SetInsertMode("BOTTOM"), the scrolling frame still doesn't work. Correction. The scroll bar works just fine :D But the scrolling frame doesn't display the message I set with :AddMessage(msg)

    That's why I was convinced there was a problem with my code, like I haven't set the font to work correctly or something.

    Ah yes, the way you set the font is not correct. You have:

     bubble.ScrollFrame.MessageFont = bubble.ScrollFrame:CreateFontString(nil,nil,"GameFontNormal") 
    

    You should be able to do one of the following:

    1. Inherit from GameFontNormal when creating the frame
    2. Use the SetFont method to set the filename, height and flags directly
    3. Use the SetFontObject method to set the font to 'GameFontNormal'

    One of those should give you some mileage.

    thank you!

    bubble.ScrollFrame:SetFontObject("GameFontNormal")

    was the correct answer! :D