Jump to content

Czar

Members
  • Content Count

    446
  • Joined

  • Last visited

  • Days Won

    13

Reputation Activity

  1. Like
    Czar got a reaction from jarto in Development updates   
    I like the lighter default theme for buttons. Thanks for the update.
  2. Thanks
    Czar reacted to lynkfs in css styling   
    Thanks
    There are however a couple of minor / major (?) caveats doing it like this :
    I made up some more metro components, and it becomes apparent that it is unavoidable to use more modifier classes: TagStyle.Add('primary image-button outline icon-left rounded etc). this type of styling is not supported by the visual designer in the ide, so styling can be done in code only. Even though only one-liners (TagStayle.Add( ) (most rtl components (but not all) have a component, a border and a background theme class baked in. Not all of these can be reused, so sometimes the border and/or background classes may end up being empty) probably the second bullet (visual designer) is the most important one for future enhancements
     
  3. Thanks
    Czar reacted to DavidRM in Node.JS WebSocket Client Socket   
    This is me sharing again.
    The NodeJS WebSocket server socket is implemented in SMS. But I didn't find an implementation of the WebSocket client socket.
    Sometimes an SMS NodeJS server needs to connect to another server. So I kinda hacked this together using the server socket as a guide.
    unit UPBNCommonNJWebSocket; interface uses System.Types, System.Types.Convert, System.Time, System.Streams, System.Reader, System.Writer, System.Device.Storage, System.Objects, SmartNJ.System, SmartNJ.Streams, SmartNJ.Device.Storage, SmartNJ.Application, NodeJS.Core, NodeJS.WebSocket, SmartNJ.Server.WebSocket; type // Forward declarations TNJWebSocket = class; TNJWebSocketOpenEvent = procedure (Sender: TNJWebSocket); TNJWebSocketCloseEvent = procedure (Sender: TNJWebSocket; Code: integer; const Reason: string); TNJWebSocketErrorEvent = procedure (Sender: TNJWebSocket; Error: TJSErrorObject); TNJWebSocketMessageEvent = procedure (Sender: TNJWebSocket; Message: TNJWebsocketMessage); TNJWebSocket = class(TW3ErrorObject) private FSocket: JWsSocket; public property WSSocket: JWsSocket read FSocket; function SocketState: JWsReadyState; function Connected: boolean; function URL: string; function Protocol: string; procedure Connect(URL: string; Protocols: array of string); overload; procedure Connect(URL: string); overload; procedure Disconnect; overload; procedure Send(const Data: variant); overload; procedure Send(const Text: string); overload; procedure Send(const Data: TStream); overload; property TagData: variant; constructor Create; override; destructor Destroy; override; procedure Ping; published property OnOpen: TNJWebSocketOpenEvent; property OnClosed: TNJWebSocketCloseEvent; property OnMessage: TNJWebSocketMessageEvent; property OnError: TNJWebSocketErrorEvent; end; implementation constructor TNJWebSocket.Create; begin inherited Create; // We dont want to throw exceptions whenever SetLastError() is called ErrorOptions.ThrowExceptions := false; end; destructor TNJWebSocket.Destroy; begin FSocket := nil; inherited; end; procedure TNJWebSocket.Ping; begin if FSocket <> nil then asm (@FSocket).ping(function() {}); end; end; function TNJWebSocket.Protocol: string; begin if FSocket <> nil then Result := FSocket.protocol; end; function TNJWebSocket.URL:String; begin if FSocket <> nil then Result:=FSocket.url; end; function TNJWebSocket.SocketState: JWsReadyState; begin if FSocket <> nil then Result := JWsReadyState( integer( FSocket.readyState) ) else Result := rsClosed; end; function TNJWebSocket.Connected: boolean; begin Result := SocketState = rsOpen; end; procedure TNJWebSocket.Connect(URL: string); begin Connect(Url, []); end; procedure TNJWebSocket.Connect(URL: string; Protocols: Array of string); begin ClearLastError(); (* disconnect socket if already connected *) if connected then disconnect(); (* Allocate new socket *) var WebSocket = WebSocketAPI; asm (@self.FSocket) = new (@WebSocket)(@URL, @Protocols); end; // initialize standard socket events FSocket.on("open", procedure begin if assigned(OnOpen) then OnOpen(self); end); FSocket.on("error", procedure (error: variant) begin SetLastError("internal websocket error"); if assigned(OnError) then OnError(self, TJSErrorObject(error)); end); FSocket.on("message", procedure (message: variant) var ResData: TNJWebsocketMessage; begin if message.IsUint8Array then begin ResData.wiType := mtBinary; ResData.wiBuffer := JBuffer(message); end else begin ResData.wiType := mtText; ResData.wiText := message; end; if assigned(OnMessage) then OnMessage(self, ResData); end); Variant(FSocket).on("close", procedure (code: integer; reason: string) begin if assigned(OnClosed) then OnClosed(self, code, reason); end); end; procedure TNJWebSocket.Disconnect; begin ClearLastError(); if Connected then begin try FSocket.close(); finally FSocket := nil; end; end; end; procedure TNJWebSocket.Send(const Data: variant); begin FSocket.send(data); end; procedure TNJWebSocket.Send(const Text: string); begin FSocket.send(Text); end; procedure TNJWebSocket.Send(const Data: TStream); begin if Data <> nil then begin if Data.position < Data.Size then begin // Get bytes from stream var Bytes := Data.Read(Data.Size - Data.Position); // Convert to typed-array var TypedArray := TDataType.BytesToTypedArray(bytes); // Send as binary FSocket.Send(TypedArray); end; end; end; end.  
    It might be a bit simplified, and it doesn't really follow the SMS component name convention, but it does what I need. And I figured I would share.
    -David
     
  4. Like
    Czar reacted to jarto in Sorting arrays and lists   
    This is a tutorial for sorting arrays and lists in Smart Mobile Studio.
    String arrays and TStringList are pretty easy to sort. You only need to call Sort:
    var strarr: array of String; ... strarr.Sort; var strlist: TStringList; strlist:=TStringList.Create; ... strlist.Sort; But how do you sort arrays of records or arrays of classes? For example:
    TSortData = record Id: Integer; Data: String; end; You can't simply call Sort as your application does not know how you want to sort the records. You solve this by using a comparison function:
    function CompareSortData(Item1, Item2: TSortData): Integer; begin result:=CompareStr(Item1.Data, Item2.Data); end; . . . var objarr: array of TSortData; ... objarr.Sort(@CompareSortData); The comparison function should return a negative number if Item1 is smaller, positive number if Item1 is bigger and 0 if they are equal.
    In Smart Mobile Studio you can also use anonymous methods:
    var objarr: array of TSortData; ... objarr.Sort( function(Item1, Item2: TSortData): Integer begin result:=CompareStr(Item1.Data,Item2.Data); end); Comparison functions can also be used for TList and even for TStringList. For example, you may want to have greater control over how names are sorted (eliminating prefixes like von):
    function EliminatePrefix(Name: String): String; const Prefixes: array[0..1] of String = ['von ','af ']; begin result:=Name; for var a:=0 to High(Prefixes) do begin if pos(Prefixes[a],result)=1 then begin Delete(result,1,Length(Prefixes[a])); exit; end; end; end; . . . var StrList:=TStringList.Create; StrList.Add('Perry'); StrList.Add('Miller'); StrList.Add('von Essen'); StrList.Add('Stockton'); StrList.Add('af Trolle'); StrList.Sort( function(Name1,Name2: String): Integer begin result:=CompareStr(EliminatePrefix(Name1),EliminatePrefix(Name2)); end); for var a:=0 to StrList.Count-1 do WriteLn(StrList[a]);  
  5. Like
    Czar reacted to lynkfs in css styling   
    Easy to use...
    Suppose we want to develop a Metro theme
    To take buttons as an example, the official metro style has a number of predefined buttons :

     
    To replicate the above, and do it in such a way that :
    the component code (TW3Button) does not need any change the standard theming classes still apply (TW3Button TW3ButtonBorder TW3ButtonBackground), but with different content of course while allowing for these different predefined component versions is to do something like this
    procedure TForm1.InitializeForm; begin   inherited;   // this is a good place to initialize components   var Button1 : TW3Button := TW3Button.Create(self);   Button1.SetBounds(20,20,83,40);   Button1.Caption := 'Default';   var Button2 : TW3Button := TW3Button.Create(self);   Button2.SetBounds(110,20,83,40);   Button2.Caption := 'Primary';   Button2.TagStyle.Add('primary');   var Button3 : TW3Button := TW3Button.Create(self);   Button3.SetBounds(200,20,83,40);   Button3.Caption := 'Secondary';   Button3.TagStyle.Add('secondary');   var Button4 : TW3Button := TW3Button.Create(self);   Button4.SetBounds(290,20,83,40);   Button4.Caption := 'Success';   Button4.TagStyle.Add('success'); end;  
    result :

     
    with the metro css file for the above looking like this
    /* ////////////////////////////////////////// // TW3Button (default) ////////////////////////////////////////// */ .TW3Button {     font-weight: 400;     text-align: center;     white-space: nowrap;     vertical-align: middle;     -webkit-user-select: none;     -moz-user-select: none;     -ms-user-select: none;     user-select: none;     border: 1px solid transparent;     padding: 0 0.75rem;     -webkit-transition: all 0.15s ease-in-out;     transition: all 0.15s ease-in-out;     background-color: #ebebeb;     color: #1d1d1d;     cursor: pointer;     outline: none;     -ms-touch-action: manipulation;     touch-action: manipulation;     -webkit-appearance: button;     /*     font-size: 0.875rem;     line-height: 34px;     height: 36px;     */ } .TW3Button:focus, .TW3Button:active {     text-decoration: none;     -webkit-box-shadow: 0 0 0 3px rgba(228, 228, 228, 0.45);     box-shadow: 0 0 0 3px rgba(228, 228, 228, 0.45); } .TW3Button:hover {     background-color: rgba(29, 29, 29, 0.1); } .TW3ButtonBackground { } .TW3ButtonBorder { } /* ////////////////////////////////////////// // TW3Button Primary ////////////////////////////////////////// */ .TW3Button.primary {     outline-color: #75b5fd;     background-color: #0366d6;     color: #ffffff; } .TW3Button.primary:hover {     color: #ffffff;     background-color: #024ea4;     border-color: #023671; } .TW3Button.primary:focus, .TW3Button.primary:active {     -webkit-box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.45);     box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.45); } /* ////////////////////////////////////////// // TW3Button Secondary ////////////////////////////////////////// */ .TW3Button.secondary {     outline-color: #b7c6cd;     background-color: #607d8b;     color: #ffffff; } .TW3Button.secondary:hover {     color: #ffffff;     background-color: #4b626d;     border-color: #36474f; } .TW3Button.secondary:focus, .TW3Button.secondary:active {     -webkit-box-shadow: 0 0 0 3px rgba(96, 125, 139, 0.45);     box-shadow: 0 0 0 3px rgba(96, 125, 139, 0.45); } /* ////////////////////////////////////////// // TW3Button Success ////////////////////////////////////////// */ .TW3Button.success {     outline-color: #adeb6e;     background-color: #60a917;     color: #ffffff; } .TW3Button.success:hover {     color: #ffffff;     background-color: #477c11;     border-color: #2d4f0b; } .TW3Button.success:focus, .TW3Button.success:active {     -webkit-box-shadow: 0 0 0 3px rgba(96, 169, 23, 0.45);     box-shadow: 0 0 0 3px rgba(96, 169, 23, 0.45); } see demo (check click and hover states)
    What do you think ?
     
    By the way, this css file is made up by screenscraping, which is actually not too bad / timeconsuming. 
    Alternatively it could also be composed out of relevant Tailwind functions, results would be very similar.
     
     
  6. Like
    Czar reacted to jarto in Development updates   
    A new update is available.
    RTL:
    Improvements to TW3StringGrid: New column types: TW3StringGridNumericColumn TW3StringGridButtonColumn Added sorting New event: OnCellChanged TStringList and TObjectList: Add Sort() with CompareFunction. Fix CSS browser prefix for Firefox Themes: Use normal size and style text in buttons.
  7. Thanks
    Czar reacted to jarto in RoadMap 2019   
    Well, I believe that open sourcing is not a silver bullet that will magically bring new resources to the project. If there are people who are interested in participating, I'll be more than happy to actually offer them contract work.
    Before I joined this project, SMS was in an eternal "coming soon" -stage. A new update was just around the corner but days turned into weeks and weeks to months and years. I didn't like that as a customer. So when I've been running this development, I've not wanted to make promises that I can't keep. Before this my family owned and ran a very succesfull software company that developed the best and most used School Administration software in Finland. We did constant development making new features. We used constant evolution. I've been doing that same thing with Smart Mobile Studio and we really have seen a lot of development and improvements. And we will see constant and good development in the future too.
    When it comes to a roadmap, I've noticed that I'm really bad at making one. A software project is a moving target. A lot of features are being worked on. In the end, it's not clear when a feature will be finished and delivered. That's because priorities do change and sometimes (for example the new Grid) technology throws us a hard challenge that takes a very long time to solve.
    At the moment our top priorities are:
    Improve documentation, tutorials, demos. Update internal browser to a newer version of Chromium. Upgrade compiler to use a newer version of DWScript. Improve IDE (Designer, Wizards) On top of that we keep a keen eye on the needs and requests of our users and add new features/components to the RTL based on that.
    @Czar Thanks for the tip about the events related bug in the IDE. I was able to reproduce it. There are restrictions on what the IDE can do at the moment. And some restrictions actually depend on what's the best way of developing for the browser. For example, it's a lot better to have fonts and font sizes in CSS instead of setting them in the Object Inspector.
    @IElite Let me know what you want to see regarding mobile devices.
  8. Like
    Czar reacted to lynkfs in css styling   
    Wow, you guys are funny.
    The question I had was : what is the easiest way to style Smart components.
    Smart ships with a couple of standard stylesheets, or themes, so styling is a matter of selecting one of these. To change the styling of a specific component in a theme, just change the css specifications in the stylesheet, either manually or through code.
    A different topic altogether is to develop new themes. It is not a simple task to f.i. develop a Metro theme stylesheet which covers all of the current Smart visual components.
    That's why I had a look at externally available css frameworks, to see if any of those would help with developing themes, or even work within the Smart development environment and if they are useful to begin with. I focused on one particular framework : Tailwindcss 
    One of the problems with themes is when it becomes necessary to deviate from it. Say a project has chosen the default theme (default.css), but for some legitimate reason somewhere in the project a standard component has to be styled differently. Example : colour a button green to amplify a positive choice and colour it red to amplify dangerous choices ("do you really want to download these files from an unknown source ?" and then display a green "No" button and a red "Yes" button).
    It's not that simple to make this actually happen.
    Lets say we change the styling of the green button (based on the standard button), and opt to do that in code :
      var Button2 : TW3Button := TW3Button.Create(self);   Button2.SetBounds(20,120,150,40);   Button2.Caption := 'No';   //   Button2.handle.style.background := '#48bb78';          //Button2.Color := clTeal;   Button2.handle.style.border := '1px solid #48bb78';    //Button2.Border.Color := clTeal;   Button2.handle.style.borderRadius := '0px';            //Button2.borderradius := 0;   Button2.handle.style.color := 'white';   // //simulate hover   Button2.handle.onmouseover := procedure(event: variant)   begin     event.target.style.background := 'orange';   end;   Button2.handle.onmouseout := procedure(event: variant)   begin     event.target.style.background := '#48bb78';   end; works sort of ok, but requires a bit of effort
    Alternatively we can change the stylesheet, so if we opt to do that for the red button then this requires
      var Button3 : TW3Button := TW3Button.Create(self);   Button3.SetBounds(200,120,150,40);   Button3.Caption := 'Yes';   //   Button3.TagStyle.Clear;   Button3.TagStyle.Add('TW3Button TW3ButtonRed');   var cssProperties := 'background-color: red;';   browserapi.document.styleSheets[0].insertRule(".TW3ButtonRed { " + cssProperties + " }", 0);   /*   .TW3ButtonRed {     background-color: red;   }   */   cssProperties := 'background-color: orange;';   browserapi.document.styleSheets[0].insertRule(".TW3ButtonRed:hover { " + cssProperties + " }", 0); either in code or adding the .TW3ButtonRed and the .TW3ButtonRed:hover manually to the stylesheet
    Again, works but requires some effort
    Using the Tailwind css framework, the above would be simplified to
    //green var Button4 : TW3Button := TW3Button.Create(self);   Button4.SetBounds(20,220,150,40);   Button4.Caption := 'No';   Button4.handle.className := "bg-green-500 hover:bg-blue-700 px-6 text-white rounded shadow-xl"; //red   var Button5 : TW3Button := TW3Button.Create(self);   Button5.SetBounds(200,220,150,40);   Button5.Caption := 'Yes';   Button5.TagStyle.Clear;   Button5.TagStyle.Add("bg-red-500 hover:bg-blue-700 px-6 text-white rounded shadow-xl");  
    Button1 : standard styling
    Button2 : changing standard styling in code
    Button3 : changing standard styling using css
    Button4/5 : using Tailwind

     
    I've probably confused everyone even more now
    Anyway, these are my thoughts : Tailwind has the advantage that it can style any of the standard Smart components. As such it could be used to make up a f.i. Metro theme. Still a significant task, but doable. Apart from that, I actually quite like Tailwind to style components on a need-to-do basis, their styling functions make the standard SMS buttons, panels, editboxes, memos etc look really good and modern.
    (A card btw is just a panel with a certain layout, where usually multiple of these panels appear on a form or page.)
     
  9. Haha
    Czar reacted to lynkfs in css styling   
    I think sometimes I'm very bad at explaining things. I'll respond over the weekend
  10. Like
    Czar got a reaction from lynkfs in RoadMap 2019   
    I too would love to see a roadmap plan for the next 12 months. The efforts have been going into special projects that not many people will probably have a use for and the bread-and-butter has been left at a usable but not great state. For example, the IDE could do with love. The fact that the visual components don't surface basics like font size/colour etc and requires work arounds and non-intuitive knowledge suggests low hanging fruit for improvements. The ide has lots of bugs and irritating issues. for example events on buttons will often be reoved or doubled up. e.g., OnSubmitClick for button can be set once but if double click on it again often it breaks.
    Would the team consider open sourcing the IDE? Or maybe looking at a completly different model. I am invested in using SMS but I did so in the hope of meaningful improvements. Jarto I believe you are only active owner and I really appreciate your efforts but you are one person and this project could be so much more with greater input from more people.
     
  11. Like
    Czar reacted to jarto in layout, wordwrap and label nightmare   
    Controls currently have no information about how they are resized or moved. They don't know that the layout is controlling it. It is possible to add a flag for that if it is beneficial. However, in this case I believe that it's easiest to just change how Autosize works:
    AutoSize True Resize width based on content. Resizing happens before WordWrap. Resize height based on content. AutoSize False Width comes from the control itself. Layout sets it in this example we've been handling. If WordWrap True, content is split into lines. If height is too small, it's increased.
  12. Like
    Czar reacted to jarto in Font size and style in buttons   
    When Lennart had his latest competition, I suggested also adding a category for Themes. I'd love to for example have a theme that looks like Windows Metro.
  13. Like
    Czar got a reaction from jarto in Font size and style in buttons   
    It would be awesome if we had a few more CSS options/themes available. I find it difficult to come up with a consistent style that varies from the ones provided. Maybe we could create a bounty to encourage someone to develop some themes?
  14. Like
    Czar reacted to lynkfs in Font size and style in buttons   
    it is a difficult job to develop themes.
    If you have an example of a theme you prefer, I might have a look (depending on the bounty)
    Cheers
  15. Like
    Czar reacted to jarto in Font size and style in buttons   
    I'd like to open up a little discussion about font sizes. Specifically, the font size in buttons, which to my eyes looks too big and bulky compared to all other text:

    Suggestion 1: Decrease font size:
    Suggestion 2: Decrease font size, remove bold and text shadow, black text:
    Which one do you guys like most?
  16. Like
    Czar reacted to jarto in layout, wordwrap and label nightmare   
    I was travelling, so didn't get to have a look right away. Gonna take a good look at this today.
  17. Like
    Czar reacted to jarto in layout, wordwrap and label nightmare   
    @Czar if you can update the zip file, I'll certainly take a look. If there are issues with TW3Label, I'll certainly want to fix them as SimpleLabel is an inferior control.
  18. Like
    Czar reacted to warleyalex in layout, wordwrap and label nightmare   
    We simply cannot open your project at labelissue.zip, missing "Form1.sfm"!
    It's an old married, TW3Label does not like the TW3Layout. Anyway, I think the unfinished widget SimpleLabel  (TW3SimpleLabel => SmartCL.Controls.SimpleLabel.pas) works "almost" as expected. 
      projTeste.zip
  19. Like
    Czar reacted to jarto in Development updates   
    A new update is available. This one contains a completely new Grid: TW3StringGrid. It's a completely new design, which was made to be very fast and able to handle lots of data. This is achieved through dynamic drawing: Only the visible grid lines are rendered.
    There is a new StringGrid-demo in the Featured Demos. It downloads a json file and populates the grid with data from it.
    RTL:
    New control: TW3StringGrid New featured demo for the StringGrid. New TW3CustomScrollControl, for developing scroll controls with scrollbars/indicators-support. New border types: btLightBorderTop, -Bottom, -Left, -Right, -Horiz and -Vert EventManager: Check TouchPreventDefault before trying to prevent extra artificial mouse events from touch events Improvements to TW3BlockBox and Modal dialogs: TW3BlockBox did not trigger a resize Dialogs did not get resized when window was resized or device flipped Make sure the dialogs are not too big
  20. Like
    Czar reacted to jarto in restrict width of page?   
    Yes, because left is changed to 0 when the form is shown.
  21. Like
    Czar reacted to jarto in TW3StringGrid is available   
    A new update is available in the development-channel of SmartUpdate. It contains a completely new Grid: TW3StringGrid. It's a completely new design, which was made to be very fast and able to handle lots of data. This is achieved through dynamic drawing: Only the visible grid lines are rendered.
    There is a new StringGrid-demo in the Featured Demos. It downloads a json file and populates the grid with data from it.
    TW3StringGrid supports six different column types:
    Text (column class TW3StringGridTextColumn) Numeric (column class  TW3StringGridNumericColumn) EditBox (column class TW3StringGridEditColumn) ComboBox (column class TW3StringGridComboColumn) Checkmark (column class TW3StringGridCheckmarkColumn) Button (column class TW3StringGridButtonColumn) Columns are created by calling:
    MyNewColumn:=Grid.AddColumn(ColumnClass);
    If no ColumnClass is given, a Text column is created.
    Column properties:
    Caption Width BorderType Default is btLightBorderRight. Set to btNone if you don't want any vertical borders. Backgroundtype Default is btNone to let the line color through. AlignText (The same way as in TW3Label) taLeft (default) taCenter taRight SelectOptions (for TW3StringGridComboColumn only) This is an array of selectable values. First value (index 0) is the value for no selection. For example: SelectOptions:=['','First','Second','Third']; RowBorderType: Default is btLightBorderBottom. Set to btNone if you don't want any horizontal borders. RowBackgroundType: Default is bsListItemBackground. Set to bsDecorativeListItemBackground (or test other backgrounds) to change the background style for even rows. RowOddBorderType: Default is btLightBorderBottom. Set to btNone if you don't want any horizontal borders. Affects odd rows. RowOddBackgroundType: Default is bsListItemBackground. Set to bsDecorativeListItemBackground (or test other backgrounds) to change the background style for odd rows. Grid properties:
    RowCount: Set number of rows to show FixedColumns: How many columns should be fixed (aka not scrollable horizontally) LineHeight MultiSelect Events:
    OnCellClick: Is triggered when the row is clicked. OnCellChanged: Is triggered when cell content changes through editing (for example: through editing) OnDrawGridLineTheme: Can be used to set custom backgrounds and borders for a row. (for example, set background to bsErrorBackground for lines that should be highlighted to the user) Methods:
    InvalidateGrid: Triggers a repaint of the grid. Sort Sorting
    TW3StringGrid supports sorting based on one of multiple columns. Clicking on the column headers sets or reverses sort order. You can also control sorting in code:
    procedure AddSortColumn(Index: Integer; SortOrder: TW3SortOrder = soNormal); overload; procedure AddSortColumn(Col: TW3StringGridColumn; SortOrder: TW3SortOrder = soNormal); overload; procedure SetSortColumn(Index: Integer; SortOrder: TW3SortOrder = soNormal); overload; procedure SetSortColumn(Col: TW3StringGridColumn; SortOrder: TW3SortOrder = soNormal); overload; procedure ToggleSortColumn(Index: Integer); For example:
    Grid.SortOptions.AddSortColumn(3,soReverse); //Set primary sort column Grid.SortOptions.AddSortColumn(1); //Add secondary sort columns Grid.Sort; Working with sorted data
    When the Grid is sorted, it only affects how data is shown. Sorting does not change Grid data itself at all. When you work with a sorted grid events and indexes (for example SelectedIndex) always refer to the index in the grid data itself and NOT the visible line number.
    TW3StringGrid uses these events:
    TW3StringGridColumnEvent = procedure(const Sender: TW3StringGridColumn; const Row: Integer); TW3StringGridEvent = procedure(const Sender: TObject; const Row, Col: Integer); If you have a Grid where "Australia" is on line 2, SelectedIndex:=2 selects that row regardless of how the grid is sorted. Clicking on that row or changing data on that row also returns Row=2 regardless of how the grid is sorted.
  22. Like
    Czar reacted to jarto in UI layout   
    Yes, we need anchors and aligns. Now that I'm about to get TW3StringGrid finished, I'll have a look at Anchors and Align.
  23. Like
    Czar got a reaction from markus_ja in UI layout   
    For me the most frustrating aspect of using SMS is layouts. Putting together anything beyond a trivial UI takes ages and is very frustrating to achieve.
    The Tlayout is not intuitive, it has weird and unexplainable side effects and takes a long time to get it right. Once you have it working then generally it is fine.
    We really need to have a more intuitive system to allow easy to create and maintain UI.
    I believe simple anchor (left, top, right, bottom)m, Align and "alignWithMargin" like Delphi has would be a great bonus to SMS.
    I have no idea what would be involved, or how much work it would be, but I would love to see this being developed.
     
  24. Like
    Czar got a reaction from IElite in UI layout   
    For me the most frustrating aspect of using SMS is layouts. Putting together anything beyond a trivial UI takes ages and is very frustrating to achieve.
    The Tlayout is not intuitive, it has weird and unexplainable side effects and takes a long time to get it right. Once you have it working then generally it is fine.
    We really need to have a more intuitive system to allow easy to create and maintain UI.
    I believe simple anchor (left, top, right, bottom)m, Align and "alignWithMargin" like Delphi has would be a great bonus to SMS.
    I have no idea what would be involved, or how much work it would be, but I would love to see this being developed.
     
  25. Like
    Czar got a reaction from IgorSavkic in UI layout   
    For me the most frustrating aspect of using SMS is layouts. Putting together anything beyond a trivial UI takes ages and is very frustrating to achieve.
    The Tlayout is not intuitive, it has weird and unexplainable side effects and takes a long time to get it right. Once you have it working then generally it is fine.
    We really need to have a more intuitive system to allow easy to create and maintain UI.
    I believe simple anchor (left, top, right, bottom)m, Align and "alignWithMargin" like Delphi has would be a great bonus to SMS.
    I have no idea what would be involved, or how much work it would be, but I would love to see this being developed.
     
×
×
  • Create New...