Jump to content

buzzdx

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by buzzdx

  1. Well, to be honest I never had this problem before and have been working with std::string like .. forever basically. I'm not sure what you mean by funny chars. If you mean ä, ü, ö etc., it usually works just fine in my other applications which use wxWidgets for UI and also databases like SQLite or MySQL. If you mean like smileys or something, then yeah, std::string can't use that. Anyway, problem solved, thanks ? While writing this I read the post you linked xD Nicely written ^^
  2. So I got it working now. The problem was indeed that I was using std::string to work on the field data. Simply converting it by creating a new WString from the string then did not work either. The solution is to just use wstring and not string to get and modify the data and finally update the data in the textfield. If you, for some reason, have to use string somewhere in the code and need to convert it to wstring you can use this code: std::wstring S2WS(const std::string& s) { int len; int slength = (int)s.length() + 1; len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0); wchar_t* buf = new wchar_t[len]; MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len); std::wstring r(buf); delete[] buf; return r; }
  3. So the problem is I'm not using the right char set? In my application the user enters something into a textbox. Then it gets stored into a string, gets modified and put back into the textfield, which is where the exception is thrown. Do I need to use wstring instead of string, or your WString class? I tried to convert the modified sting variable to your WString type like: txt->SetText(Wstring(stringvar)); but that didn't work either.
  4. Hi, I just tried to use the SetText method on a textfield with a value containing "ä". This results in an exception being thrown: std::range_error. The following code reproduces the error: auto txttarget = CreateTextField(515, 5, 400, 24, detailpanel); txttarget->SetText("ä"); It's the same for ö and ü. Am I doing something wrong or is this a bug?
  5. Yeah it's like a very niche thing, if it will ever be used at all. But since I was reporting the things I encountered I just wanted to share this too.
  6. I wasn't aware that the key is named differently on US keyboard layouts, sry for the confusion. Thanks for clarifying klepto2.
  7. So this one is a bit hard to explain. By mystake I created a button which was partly below another widget created after the button. So half the button is visible, but the lower part is hidden behind a tree view. When I click on the button (press and let go) and then move the mouse down, leaving the button by entering the area of the tree control, the button does not notice it lost focus and will keep the blue border. It will notice only when I click on something else in the window. The following setup should illustrate and recreate the "problem". I'm not sure if it can be called a bug though, usually buttons won't be half behind other widgets i guess. //Get displays auto displays = GetDisplays(); //Create window mainwindow = CreateWindow("xyz", 0, 0, 1040, 827, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create user interface ui = CreateInterface(mainwindow); iVec2 sz = ui->root->ClientSize(); auto mainpanel = CreatePanel(0, 9, sz.x, sz.y, ui->root); auto btn_bdx = CreateButton("", 904, 80 /*20*/, 80, 80, mainpanel); tree = CreateTreeView(10, 125, sz.x - 20, 500, mainpanel, TreeViewStyle::TREEVIEW_DEFAULT); To replicate the behaviour: Move mouse onto button, click once. Then move mouse down onto the tree ctrl. The button will keep the blue border/focus state. Click anywhere in the window and the button will notice it has no focus anymore and remove blue border. Thanks,
  8. In the create slider function documentation it says the slider has a defined range. I could not find a function in the documentation that does that. I found the SetRange() function which seems to be doing that, but I'm not sure why it takes an x and y value for a one dimensional slider. Could you please clarify how to set the range of a slider and add it to the docs? Thanks,
  9. When working with textfields I noticed that they do not react to SHIFT+POS1 and SHIFT+END commands. Is it possible to add these to textfields in an update? Thanks,
  10. In my project I created a button to delete items. When the button is pressed and the item gets deleted the button will be turned off/disabled. Since the mouse is still over the button when it gets disabled, the button will then keep its blue border even when the mouse moves out of it afterwards. So it seems like it's not detecting the loss of focus while being disabled. However, it will lose the stuck border as soon as I click on anything else in the window. I tried this to overcome the problem: // first try to fix it btn->SetState(false); btn->Redraw(); // trying to emit the mouseleave, but I think it can't get handled before the next line of code. either way has no effect. EmitEvent(Event(EVENT_MOUSELEAVE, btn)); btn->Disable(); // try to fix and redraw after disabling, no effect btn->SetState(false); btn->Redraw(); but nothing worked so far.
  11. Alright, will do tomorrow. Bed is calling ^^ Good night!
  12. I'll try to do that, sure. For the one with the button border we had already talked about a few weeks ago too, or just the new ones?
  13. Hi again, I'm currently facing a problem which is linked to the last one. Right now I have a button, and upon pressing the button it needs to get disabled. This time the mouse is still on the button at the time it gets disabled and thus again keeps the blue border. I think this should be fixed when you put in that fake mouse-leave event to button->disable(). However, is there a way to make this work as of now? I tried this: // first try to fix it btn->SetState(false); btn->Redraw(); // trying to emit the mouseleave, but I think it can't get handled before the next line of code. either way has no effect. EmitEvent(Event(EVENT_MOUSELEAVE, btn)); btn->Disable(); // try to fix and redraw after disabling, no effect btn->SetState(false); btn->Redraw(); So far I couldn't get it to work. Do you have any idea how to get it work, or should I leave it be at the moment and wait for a new release? Thanks edit: I noticed the keyboard combinations SHIFT+POS1 as well as SHIFT+END do not seem to work in textfields for selecting text. Is it possible to add these? edit 2: By mistake I placed a button so that it is half hidden, i.e. it is half hidden behind another control. when clicking the button and then moving the mouse onto the control which is drawn over it, the button will not notice that the other control gained focus and keep its blue border. on the other hand when the widget above the button was clicked before and the mouse moves between the two the border works properly, i.e. blue when mouse is over and no blue border when it leaves again. edit 3: Is the function SetRange() the one for setting the, well .. range, for a slider widget? I think it's missing in the documentation?
  14. Hi there, I've discovered another small thing I wanted to let you know about and maybe there is a way to fix this. So I have several buttons which get enabled and disabled depending on what type of item is selected in my treeview. One button is for adding files. In the event handler of that button I call the RequestFile() function which opens the popup dialog. After a file has been selected the dialog closes and the new item is added to my data structure. The tree then rebuilts itself to reflect the changes and call the function to enable/disable buttons. At this time, sometimes the add file button still has the blue border as if the mouse was hovering over it, yet, the mouse has been moved away the moment the popup dialog opened. During the popup dialog, which disabled the main window, the button also stays in this hover state, having the blue border. Now when my code disables the button, it still retains the blue border, but now since it is disabled, it won't go away even when hovering over and then leaving it with the mouse. I managed to fix this by adding btn->SetState(false); btn->Redraw(); before btn->Disable(); for now. Not sure if both are needed, but it works right now. Maybe you could add code to make the buttons lose the hover state when disabling them? Or is what I do here like .. a fringe case and not worth adding to the library?
  15. I'll try to get it working like that later, will let you know how it went. Edit: Got it to work so far, thanks again. Is there an ETA for the new build?
  16. Hey there, you supplied this code for selecting a node: auto treeview = CreateTreeView(10, 10, sz.x - 20, sz.y - 20, ui->root, TREEVIEW_DRAGANDDROP | TREEVIEW_DRAGINSERT); treeview->SetLayout(1, 1, 1, 1); auto node = treeview->root->AddNode("Node 1"); node->AddNode("Subnode 1"); node->AddNode("Subnode 2"); node->AddNode("Subnode 3"); treeview->Draw(0, 0, 0, 0); treeview->SelectNode(node); including the temporal fix to make selectnode work. Now I'm trying to select one of the subnodes like this: auto treeview = CreateTreeView(10, 10, sz.x - 20, sz.y - 20, ui->root, TREEVIEW_DRAGANDDROP | TREEVIEW_DRAGINSERT); treeview->SetLayout(1, 1, 1, 1); auto node = treeview->root->AddNode("Node 1"); auto subnode = node->AddNode("Subnode 1"); node->AddNode("Subnode 2"); node->AddNode("Subnode 3"); treeview->Draw(0, 0, 0, 0); treeview->SelectNode(subnode); which yields a "vector subscript out of range" exception. Is this a bug too, or do I have to change the code to select one of the subnodes? I need this to re-select a node with a certain text after recreating the treeview from my data structures. In my own code it also works with the rootnode but not with subnodes like in the example above.
  17. As always, thanks for your quick answers! I'm glad it helps you too in finding these things to iron out in new releases.
  18. So, I moved forward with my project, which is a backup tool in which you can setup all the files and directories you want to backup, and then do the actual backup which automatically zips the files and folders. I've come across another question though: Is there a method to delete nodes from a tree? I tried ClearItems but that does not seem to have an effect on treeviews. I found that the nodes are vectors of widgets. Trying to clear the kids vector (no matter if for tree->root or an actual node) results in a debug break / call to abort() - but i can't really tell what's causing it. What I need is to delete a node that has been selected. Another question I'm having right now is how to force redraw the tree. I have a textfield in which the user can change the name of nodes. When enter is pressed the node's text is changed. But it doesn't show in the tree. I tried: tree->Invalidate(true); tree->Refresh(); tree->Redraw(); tree->Draw(0,0,tree->GetSize().x, tree->GetSize().y); as well as calling all four on a node rather than the tree. But none of them had an effect. It only shows the change when selecting another node. What I found as a workaround to both of these problems is to recreate the tree completely, that is doing another CreateTreeView on the same variable. This should remove the old one from memory as it goes out of scope. But it's not a clean solution. What is the right way to update nodes and directly show it, and how to delete nodes from a treeview?
  19. Oh lol ^^ And I was already questioning my reading skills xD
  20. I feel stupid now for not having found SelectNode ^^ Well, at least it helped finding that bug I guess.
  21. Thanks again, that works. Just for your information: I'm trying to find the information I'm asking for in the documentation first before coming here. It's just that I cannot find certain things or they don't work like I expected. Please bear with me ? Been trying for an hour now to get the treeview to select a node on program startup. I managed to emit this event EmitEvent(EVENT_WIDGETSELECT, tree, 1, 0, 0, 0, 0, rootnode); and catch it with my event listener. I can print the node name and it is the right node (rootnode) that gets selected. However, the treeview does not show visually that it is selected. Also, when I click on the rootnode with the mouse (after it has been selected by the emitted event) it gets selected again (my event listener runs again). After it got selected manually with the mouse, and visually shows that this node is selected., the event listener will not run again when clicking on the same node again with the mouse. Can this be solved programatically?
  22. I'm trying to change the background color of a tree view. It doesn't seem to react to it, neither using tree->SetColor(0, 0, 255, 1.0f, WIDGETCOLOR_BACKGROUND); nor by creating a custom theme and changing bg color there. Am I doing it wrong or does it not support a custom background color? Changing e.g. the border does work. Also could you please upload the treeview's widget code to github? With that I could change the bg color myself by making it a custom control.
  23. Turns out it's really easy to set a window icon. Include the icon in your .rc file like this: appicon ICON "path_to_icon/icon.ico" And then in C++ set the icon like this: //Create window auto mainwindow = CreateWindow("Ultra App Kit", 0, 0, 1024, 768, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR | WINDOW_RESIZABLE); HICON hIcon = LoadIconA(GetModuleHandle(0), "APPICON"); SendMessage(mainwindow->GetHandle(), WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(mainwindow->GetHandle(), WM_SETICON, ICON_BIG, (LPARAM)hIcon);
  24. Hi again, so I did compile Poco as static MT libs and so far it seems to work fine ? Had to fiddle a bit with the project settings to get rid of the console window. Your template was helpful for that. One thing I could not find in the documentation was how to set a window icon. Is there a function for it, or do I need to invoke win32 for that? After that my appkit adventures can begin ^^
×
×
  • Create New...