Jump to content

[HELP] Automatically change text


*RaCeR^

Recommended Posts

Posted

Hello everybody, i'm here for help with a little problem.

I'm trying to create a Youtube Browser to play songs for the whole server. but Link does not update itself as it should.

Can anyone tell me a function that does when I click the link it automatically changes the URL in the text bar?

 

Below this to change when you click a button. I wanted him to change alone. 

function geturl()
if source == CINEMA.button[1] then
	guiSetText(addressBar,getBrowserURL(theBrowser))
	end
end
addEventHandler("onClientGUIClick",root, geturl)


Can somebody help me ? Thx s2 
 

Hello World :D

Posted

it's an event you attach it to your browser element like how you attached the onClientClick event to the cinema button.

function geturl()
	guiSetText(addressBar,getBrowserURL(source))
end
addEventHandler("OnClientBrowserNavigate",theBrowser, geturl)

This event will be called every time the browser navigates to a different page.

Posted

Sorry, but i try this and not working :c, It's a simple thing that's giving me a headache. the EDIT bar not Recognize.

Hello World :D

Posted (edited)
function geturl(theBrowser) -- Function of URL Link to guiSetText with a Button Command
if source == CINEMA.button[1] then
	guiSetText(addressBar,getBrowserURL(theBrowser))
	end
end
addEventHandler("onClientGUIClick",root,geturl)

local theBrowser = guiGetBrowser(browser) -- Function of the Browser
addEventHandler("onClientBrowserCreated", theBrowser, 
	function()
		loadBrowserURL(source,"https://www.youtube.com")
	end
)

Don't have any errors in debugscript and it works with the button function, if i put the function to he goesn't alone :c 

If anyone can help me with this file, contact me Pv. Please :c ( i send the script )

Edited by *RaCeR^

Hello World :D

Posted (edited)

Please explain:  "when I click the link it automatically changes the URL in the text bar?"

Which link and where? Are you talking about links that are rendered within the browser or any GUI/DX text link?

The code provided by LopSided_  should work absolutely fine. 

 

local theBrowser = guiGetBrowser(browser) -- Function of the Browser

addEventHandler("onClientBrowserCreated", theBrowser,
function()
    loadBrowserURL(source,"https://www.youtube.com")
end )


function geturl(targetURL)
    guiSetText(addressBar, getBrowserURL(targetURL))
end
addEventHandler("OnClientBrowserNavigate",resourceRoot, geturl)

 

Edited by dk99
  • Like 1

 

 

Posted
9 hours ago, dk99 said:

Please explain:  "when I click the link it automatically changes the URL in the text bar?"

Which link and where? Are you talking about links that are rendered within the browser or any GUI/DX text link?

Yes, the URL Changes in the text bar automatically, 

Yes, Every Link, and Rendered within the Browser, like Chrome example, but for the Youtube, u Click on a Video and URLText changes automatically. ( i can make a little video for explain if u want )

 

Hello World :D

Posted

Update: http://imgur.com/a/T1KbC


It works only when you put it in 1 time it goes, then it does not work anymore.

type: i'm enter the youtube, but, if i click on a video, the URL don't change.

function geturl(theBrowser, b)
    bool = true
    for b, v in string(b, browser) do
    guiSetText(addressBar, getBrowserURL(theBrowser))
    end
end
addEventHandler("onClientBrowserNavigate",root,geturl)
addEventHandler("onClientBrowserDocumentReady",root,geturl)

 

Hello World :D

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...