bmmsr Posted December 29, 2024 Posted December 29, 2024 Dear UniGUI Support, I am currently testing both UniGUI and IntraWeb as part of a migration process for a VCL application to the web. During my testing of UniGUI, I have encountered two issues that I would like assistance with: DBGrid Column Visibility Issue: In the UniGUI DBGrid, when I click on the grid, go to "Columns", and uncheck columns to hide them, they disappear as expected. However, once I refresh the page or close and reopen the application, all the columns are displayed again. I would like to know how to keep the columns hidden even after refreshing the page or restarting the application. The application I am migrating is multi-user, and each user should be able to choose which columns they want to display. For example, User 1 may choose to display columns such as ID, Name, and Phone, while User 2 may choose to display Name, Address, and Email, hiding the others. Multi-Language (RTL and LTR) Issue: My application is multilingual, supporting both RTL and LTR languages. The issue I have encountered is that when User 1 selects RTL on PC 1, all other users (User 2 on PC 2 and User 3 on PC 3) also experience the application in RTL, even if they have selected LTR. I would like to know how to ensure that User 1 remains in RTL while User 2 and User 3 remain in LTR, regardless of the choices made by other users. Any assistance or guidance you can provide on resolving these issues would be greatly appreciated. Thank you for your support. Best regards, BM Quote
Wilton Ergon Posted December 30, 2024 Posted December 30, 2024 1- you can, when closing the form, loop through the columns, and save this visibility information in a table in your database, in create you read it and recover the visibility, unigui does not do this automatically 2- where are you putting this routine to treat language? try putting it in the mainmodule.. put something in the servermodule, it will be shared between all connections Quote
bmmsr Posted December 31, 2024 Author Posted December 31, 2024 Thank you for your response! Regarding the multi-language issue: I already handle RTL activation in the MainModule, not in the ServerModule. Despite this, the issue persists, and I am unsure why the language settings are still being shared across all users. Do you have any further suggestions to investigate or resolve this? Thank you again for your assistance! Quote
bmmsr Posted January 4 Author Posted January 4 Does anyone have any suggestions for the issue of RTL? Quote
Sherzod Posted January 4 Posted January 4 2 hours ago, bmmsr said: Does anyone have any suggestions for the issue of RTL? Hello, Thank you for your interest in uniGUI. Yes, one way to achieve this is by using logic in uniMainModule, specifically the OnCreate and OnNewComponent events. The question is, how do you determine whether RTL or LTR should be applied for a specific user? Is it based on the login form or stored in cookies? Quote
bmmsr Posted January 4 Author Posted January 4 Hello, Thank you for your response and for your assistance. Regarding the determination of whether RTL or LTR should be applied, I would like to store this preference on a per-user basis. The preference could either be based on the login form. I am considering storing this in the user session (for persistence across sessions) and then applying the appropriate RTL/LTR setting in the uniMainModule. Could you provide an example of how to achieve this by utilizing the OnCreate and OnNewComponent events in uniMainModule? I would appreciate any further guidance on handling this in a multi-user environment where each user can have their own language direction preference. Thank you for your help! Best regards, Quote
bmmsr Posted January 8 Author Posted January 8 The Unigui support is Bad I will look for Intraweb😡 Quote
Sherzod Posted January 8 Posted January 8 2 minutes ago, bmmsr said: The Unigui support is Bad I will look for Intraweb😡 Don't jump to conclusions. Sorry if we couldn't help you in time. I forgot to respond. Good luck anyway! Quote
bmmsr Posted January 8 Author Posted January 8 Hello, Thank you for your response. I appreciate you taking the time to address my concern. I understand that delays can happen, and I did not intend to sound overly critical. My main frustration stemmed from not receiving any guidance after tagging the moderator, especially as I’m evaluating uniGUI for a critical project. I value the potential of uniGUI and hoped to receive timely support during this evaluation period to make an informed decision. I apologize if my previous message came across as abrupt. I would still appreciate any advice or direction regarding the issues I raised earlier. Best regards, Quote
Sherzod Posted January 9 Posted January 9 Hello @bmmsr Np. I may have responded hastily when I said: "one way to achieve this is by using logic in uniMainModule, specifically the OnCreate and OnNewComponent events." Currently, this is not supported by standard uniGUI tools, as different JS/CSS files are loaded on the main page. However, I have a preliminary solution using a parameter in the request, which I mentioned earlier and will share. Further solutions can be explored, specifically by storing the parameter in cookies and reading the value later (you can find examples of using cookies in the uniGUI demo samples). In both this case and when the parameter is not explicitly specified (i.e., cookies are not used), you will need to restart the session with parameters for the changes to take effect. unit MainModule; interface uses uniGUIMainModule, SysUtils, Classes, uniGUIClasses; //uniGUIClasses should be included type TUniMainModule = class(TUniGUIMainModule) procedure UniGUIMainModuleCreate(Sender: TObject); procedure UniGUIMainModuleNewComponent(AComponent: TComponent); private { Private declarations } public { Public declarations } end; function UniMainModule: TUniMainModule; implementation {$R *.dfm} uses UniGUIVars, ServerModule, uniGUIApplication; function UniMainModule: TUniMainModule; begin Result := TUniMainModule(UniApplication.UniMainModule) end; procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject); begin // localhost:8077/?rtl=true if UniSession.QueryParams.Values['rtl'] = 'true' then RTL := True; end; procedure TUniMainModule.UniGUIMainModuleNewComponent(AComponent: TComponent); begin if UniSession.QueryParams.Values['rtl'] = 'true' then if (AComponent is TUniControl) then (AComponent as TUniControl).RTL := True; end; initialization RegisterMainModuleClass(TUniMainModule); end. Quote
bmmsr Posted January 10 Author Posted January 10 Hello, Thank you for providing the code; it works partially and addresses the issue to some extent. However, there’s still a problem that occurs in a multi-user scenario: Initially, on PC 1, a user connects to the application and chooses English (LTR). On PC 2, a second user connects, and by default, they see English (LTR). The user on PC 2 switches to Arabic (RTL). When the user on PC 1 logs out and logs back in, they see the RTL menu, but the text remains in English. Similarly, when the user on PC 1 switches back to English (LTR), and the user on PC 2 logs out and logs back in, they see the LTR menu, but the text remains in Arabic. In summary, this solution only keeps the text language (Arabic/English) consistent per user but not the menu orientation (RTL/LTR). Do you have suggestions for a way to preserve both the menu orientation (RTL/LTR) and the text language per user session? It seems the current logic affects components inconsistently between users. I appreciate your support and insights on this! Best regards, Quote
Sherzod Posted January 13 Posted January 13 Hello @bmmsr Thank you for your detailed feedback and clarification regarding the RTL/LTR issue. Currently, uniGUI does not offer native support for dynamic switching between RTL and LTR modes, as this feature is not fully implemented at the framework level. The behavior you described, where one user's settings affect another, may be related to the incorrect use of global variables. Please refer to the following documentation for handling concurrency correctly: Handling Concurrency in uniGUI. If session-based language and layout separation is critical for your project, you might want to explore alternative frameworks, such as IntraWeb, which you previously mentioned considering. Thank you. Quote
bmmsr Posted January 13 Author Posted January 13 Thank you for your response and the clarification regarding RTL/LTR handling in uniGUI. I understand that dynamic switching is not fully supported natively, and I appreciate your point regarding concurrency and the potential misuse of global variables. I will review the documentation you suggested about handling concurrency in uniGUI. That said, session-based language and layout separation is indeed critical for my project. While I am open to exploring alternative frameworks like IntraWeb, I would prefer to find a solution within uniGUI if possible. Could you provide further guidance or suggest any workarounds to better handle session-specific settings for language and layout? For instance, would maintaining these settings solely in the session context (without relying on global variables) mitigate the issues I’m facing? Thank you for your support. Quote
Theo Posted January 13 Posted January 13 Hi, i didnt't understand the problem exactly. But why don't you use just 2 seperate websites with the same program. One is configured for RTL the other for LTR. With a Redirection you can switch from one to the other. Quote
bmmsr Posted January 13 Author Posted January 13 1 hour ago, Theo said: Hi, i didnt't understand the problem exactly. But why don't you use just 2 seperate websites with the same program. One is configured for RTL the other for LTR. With a Redirection you can switch from one to the other. Hi, Thank you for your response and the suggestion. While I understand the idea of using two separate websites configured for RTL and LTR, I would appreciate it if you could provide more details on how to implement this approach effectively. How exactly would the redirection between the two websites work? Would it involve detecting the user's language or preference at the beginning of the session and redirecting them accordingly? Any additional guidance or example steps on how to set this up within uniGUI would be greatly appreciated. Looking forward to your insights. Thank you! Quote
Theo Posted January 14 Posted January 14 sorry, i cannot help you, i dont want to tell you something wrong. I am a newbie at unigui. I am coming from another framework that was discontinued. It was just an idea that should be easy to realize. 1 Quote
Wilton Ergon Posted January 16 Posted January 16 on the main page of the company that hired you to create this solution, create 2 buttons one to access the system in Arabic another in English or, create an initial website that will have these 2 buttons, each button accesses the respective website. Each site will open in the predefined language, regardless of the user opening it. It is very likely that your Arabic-speaking user will not access the site in English, and neither will the opposite. so this shouldn't be a user-defined thing. This way, you maintain just one project, but with 2 different installations that can even be on different servers. Quote
bmmsr Posted January 19 Author Posted January 19 On 1/16/2025 at 9:15 PM, Wilton Ergon said: on the main page of the company that hired you to create this solution, create 2 buttons one to access the system in Arabic another in English or, create an initial website that will have these 2 buttons, each button accesses the respective website. Each site will open in the predefined language, regardless of the user opening it. It is very likely that your Arabic-speaking user will not access the site in English, and neither will the opposite. so this shouldn't be a user-defined thing. This way, you maintain just one project, but with 2 different installations that can even be on different servers. Hi, Thank you for your suggestion. However, I believe there might be a misunderstanding about my requirements. I am not looking to create two entirely separate websites or installations. The goal is to have a single site where each user can dynamically choose their preferred language (Arabic or English) and corresponding orientation (RTL or LTR). This preference should be stored and maintained per session so that multiple users can use the application simultaneously with their individual settings, without affecting each other. Your approach works for projects targeting static audiences, but in my case, users need the ability to switch dynamically within the same application. If you have ideas on how to achieve this in uniGUI, I would love to hear them! Thank you. Quote
bahry Posted February 18 Posted February 18 Hello @bmmsr UniGui fully support Multi Language, I think you didn't implement the RTL correctly in the MainModule Unit. You can Set the language in The LogIn form TUniGUIApplication(UniApplication).Cookies.SetCookie('LANGUAGE', '1', Date+60); // 1 or 0 as you like and After you Change the Language you should restart the Application (UniApplication as TUniGUIApplication).Restart; in the OnCreate of the DataModule var iLang : string; iLang := TUniGUIApplication(UniApplication).Cookies.Values['LANGUAGE']; RTL := (iLang = '1'); now all forms/Frames ParentRTL in the Application must be True; OnCreate of the Form/Frame you can change the Captions in any language you like, but if you are using tsiLang Components it needs specific changes to work correctly in UniGui. Regards Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.