Jump to content

RonShortt

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by RonShortt

  1. A textarea using TEXTAREA_WORDWRAP and SetFontScale does not wrap text correctly. Adding textarea->SetFontScale(1.5); to the textarea example code results in text which goes off the screen to the right. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->ClientSize(); auto textarea = CreateTextArea(10, 10, sz.x - 20, sz.y - 20, ui->root, TEXTAREA_WORDWRAP); textarea->SetFontScale(1.5); WString s = L"Night was falling now, and as I recalled what Akeley had written me about those earlier nights \ I shuddered to think there would be no moon. Nor did I like the way the farmhouse nestled in the lee of that\ colossal forested slope leading up to the Dark Mountain’s unvisited crest. With Akeley’s permission I lighted a small oil lamp,\ turned it low, and set it on a distant bookcase beside the ghostly bust of Milton; but afterward I was sorry I had done so, for \ it made my host’s strained, immobile face and listless hands look damnably abnormal and corpselike. He seemed half-incapable of motion, \ though I saw him nod stiffly once in a while."; textarea->SetText(s); textarea->SetLayout(1, 1, 1, 1); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } Untitled.bmp
  2. It's funny but I had misread the TextArea widget and thought it was an input field so it does do exactly what I need. Thanks for the advice.
  3. It is an area of the screen where I am writing output from the program on an ongoing basis as the program runs. I will take a closer look at the text area widget this evening and see if I can use that to accomplish the same thing.
  4. So I dug out my 30 year old copy of Introduction to the X Window System (Updated for XVIIR4) and started reading. In the section on fonts it says: That would indicate that either Ultra App Kit or my program must deal with the newline character as the X Window system simply treats it as just another (unprintable) character.
  5. I have used GetText to retrieve the text after it is (improperly) displayed and printed it via cout and the newline in the returned string works as expected. The issue seems to be that the Linux library is not dealing with the newline in the same (proper) manner as the Windows library.
  6. Unfortunately std::endl operates on the output I/O system rather than providing a newline character. According to the link you provided:
  7. My program is working fine in Windows when I use '\n' in a c++ string to get a newline in the text of a label. I have now compiled it on Linux and the newline character is displayed as a character block as if the character cannot be displayed. Is there a way to get Linux to execute the same way as Windows. Here is sample code (a slightly modified version of the label sample code)? #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0]); //Create User Interface auto ui = CreateInterface(window); //Create widget auto label1 = CreateLabel("Label", 20, 20, 120, 30, ui->root); auto label2 = CreateLabel("Border\nLabel", 20, 50, 120, 60, ui->root, LABEL_BORDER | LABEL_CENTER | LABEL_MIDDLE); while (window->Closed() == false) { WaitEvent(); } return 0; }
  8. That is exactly what I was looking for! Thank you very much! I am really enjoying programming with this package.
  9. I am loading a number of SVG icon files and wondered if there was a way to embed them in the C++ source code so that I don't need to include the files with the executable. LoadIcon only accepts a file name or Stream as the icon source.
×
×
  • Create New...