VasiDe Posted June 14, 2019 Posted June 14, 2019 Hi everyone, I am playing with C# for RageMP I unfortunately I don't get one thing with CEF. I'm keep learning how to use some events and this time I have to create some UI to use them. UI based on Javascript works great (e.g. https://rage.mp/forums/topic/1896-cef-tutorial-interact-with-browser-pages-in-ragemp-client-and-server/) however when I write my own code in C# - it does not show at all. I am using Stuyk tutorial from https://www.youtube.com/watch?v=NJsktWiY5W8 and it is not working. Even tried to copy everything 1:1 and script literally does not respond. Recent code (based on Stuyk tutorial): using System; using RAGE; using RAGE.Elements; using RAGE.Ui; namespace hello { public class Main : Events.Script { RAGE.Ui.HtmlWindow CustomWindow = null; public Main() { LoadCEF("package://html/index.html"); } public void LoadCEF(string uri) { CustomWindow = new HtmlWindow(uri) { Active = true }; } } } html file contains proper template with HTML5 encoding and body bg color set for black only. Works with local browsers such as Firefox and Chrome. Cleared cache memory several times to make sure it's overwriting the new one. Some suggestions? Thank you in advance VasiDe
Miep3r Posted June 21, 2019 Posted June 21, 2019 Where did you save the HTML File? Remember it has to be placed in "client_packages/html" in your case.
KumaTA Posted September 16, 2019 Posted September 16, 2019 Hey VasiDE, did u solved that already? I'm stuck with the same problem. would be nice if u could tell me your solution.
ConnorGuy Posted December 15, 2024 Posted December 15, 2024 Was trying to find out why the wiki way does not work - https://wiki.rage.mp/index.php?title=RAGE.Ui.HtmlWindow.Active Then I came across the post of someone having the same issue but years ago and unanswered, but today finally someone answers, this may not be useful for the guy who made this post anymore but could help others like me who was looking for answers. The wiki shows an example like this: HtmlWindow ShopCEF = new HtmlWindow("package://cef/shop/index.html"); private void openUI() { ShopCEF.Active = true; Rage.Ui.Cursor.Visible = true; } private void closeUI() { ShopCEF.Active = false; Rage.Ui.Cursor.Visible = false; } This example is incorrect and does not work, an correct working example would look like this: HtmlWindow ShopCEF = new HtmlWindow("http://package/cef/shop/index.html"); Hope this helps someone else in the future. Note: I asked few time for access edit the wiki, so stuff like this can be fixed but we never seem to get an answer or fix to this. When attempting to create an account to edit the wiki you are meet with a cloud flare block. No new account has been able to be made for years come on fix it please, Some of us really want to contribute.
sssander Posted January 4, 2025 Posted January 4, 2025 On 12/15/2024 at 5:33 PM, ConnorGuy said: Was trying to find out why the wiki way does not work - https://wiki.rage.mp/index.php?title=RAGE.Ui.HtmlWindow.Active Then I came across the post of someone having the same issue but years ago and unanswered, but today finally someone answers, this may not be useful for the guy who made this post anymore but could help others like me who was looking for answers. The wiki shows an example like this: HtmlWindow ShopCEF = new HtmlWindow("package://cef/shop/index.html"); private void openUI() { ShopCEF.Active = true; Rage.Ui.Cursor.Visible = true; } private void closeUI() { ShopCEF.Active = false; Rage.Ui.Cursor.Visible = false; } This example is incorrect and does not work, an correct working example would look like this: HtmlWindow ShopCEF = new HtmlWindow("http://package/cef/shop/index.html"); Hope this helps someone else in the future. Note: I asked few time for access edit the wiki, so stuff like this can be fixed but we never seem to get an answer or fix to this. When attempting to create an account to edit the wiki you are meet with a cloud flare block. No new account has been able to be made for years come on fix it please, Some of us really want to contribute. Fixed
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now