Jump to content

lynkfs

Moderators
  • Content count

    343
  • Joined

  • Last visited

  • Days Won

    1

lynkfs last won the day on February 25

lynkfs had the most liked content!

About lynkfs

Profile Information

  • Gender
    Male
  • Location
    Australia

Recent Profile Visitors

233 profile views
  1. Editbox autocomplete

    or derive a (rather simple) new component from TW3ComboBox unit Unit2; interface uses System.Types, SmartCL.System, SmartCL.Components, SmartCL.Controls.ComboBox, SmartCL.Controls.EditBox; type TW3ComboBoxPredict = class(TW3ComboBox) protected constructor Create(AOwner: TW3CustomControl); override; Procedure ObjectReady; override; public EditBox : TW3EditBox; end; implementation //############################################################################# // TW3ComboBoxPredict //############################################################################# constructor TW3ComboBoxPredict.Create(AOwner: TW3CustomControl); begin inherited Create(AOwner); EditBox := TW3EditBox.Create(AOwner); end; Procedure TW3ComboBoxPredict.ObjectReady; begin EditBox.SetBounds(left,top,width-20,height+2); EditBox.OnKeyUp := procedure(Sender: TObject; const Key: integer) begin If Key <> 8 then begin //backspace var occurrence : integer := 0; var z : integer := 0; For var i := 0 to self.GetCount -1 do begin If Pos(Uppercase(editbox.text), UpperCase(self.Items[i])) > 0 then begin inc(occurrence); z := i; end; end; If occurrence = 1 then begin EditBox.Text := self.Items[z]; end; end; end; self.OnChanged := procedure(sender:TObject) begin EditBox.Text := self.Items[selectedindex]; end; end; end. invoke as ComboBoxPredict := TW3ComboBoxPredict.Create(self); ComboBoxPredict.SetBounds(50,50,200,30); ComboBoxPredict.Add('Amsterdam'); ComboBoxPredict.Add('Athens'); ComboBoxPredict.Add('Bandar Abbas'); ComboBoxPredict.Add('Bandung'); ComboBoxPredict.Add('Bangalore'); ComboBoxPredict.Add('Cambridge'); reacts on any unique substring : typing 'amb' produces 'Cambridge'
  2. graph

    It occurred to me that the graph data-structure could be used as a storybook. Graphs are basically nodes or vertices connected by lines or edges. The below example graph is taken from the W3C primer on it's Resource Description Framework - fascinating reading by the way. There's more to graphs than meets the eye. Anyway, a humble use would be to be able to set up any type of graph and populate the vertices and edges with story snippets. Users would then be able to click on any of these nodes and thus create a story. Sort of like hyperlinks but with the difference that this would be more constrained. Hyperlinks can jump to anywhere but graph based linked data needs to follow the graph structure. Furthermore these snippets would be collected in a story-line. The project here does just that. Click on The Mona Lisa, the dropdown arrow, Leonardo da Vinci etc. Snippets are added to the bottom of the scroll box. Notes : some of the data in this graph is obviously nonsensical. Notes : I've used the html <details> and <summary> tags. Works fine on Chrome / FireFox but not on Edge. Notes : Adding type-data to nodes and edges, storing graphs & enablinq queries on it, graph-reasoning and some other ideas come to mind as possible extensions. Enterprise-ready version maybe.
  3. Editbox autocomplete

    Save some for me
  4. Editbox autocomplete

    autocapitalize The autocapitalize attribute doesn’t affect behavior when typing on a physical keyboard. Instead it affects the behavior of other input mechanisms, such as virtual keyboards on mobile devices and voice input. Possible attribute values: 'off', 'on', 'sentences', 'words' or 'characters' https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize autocorrect This is a non-standard attribute supported by Safari that is used to control whether autocorrection should be enabled when the user is entering/editing the text value of the <input>. Possible attibute values are on or off https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input autocomplete This attribute indicates whether the value of the control can be automatically completed by the browser. Possible values are quite a few. One of them being "on": The browser is allowed to automatically complete the value based on values that the user has entered during previous uses, however "on" does not provide any further information about what kind of data the user might be expected to enter. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input What you probably want is something else, also suggested by @IElite : the 'list' attribute of the editbox The 'list' attributes identifies a list of pre-defined options to suggest to the user. The value must be the id of a <datalist> element in the same document. The browser displays only options that are valid values for this input element. This attribute is ignored when the type attribute's value is hidden, checkbox, radio, file, or a button type. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-list Basically it provides a dropdown listbox which also does autocompletion (that is, it checks if any of the typed characters are present in the list of items and selects those. So typing in 'a' will select both 'Paris' and 'Amsterdam', but if the second keystroke is 'm' then only 'Amsterdam will be selected. There are some differences between Chrome, Firefox and Edge in this respect). The html equivalent is : <input list="capitalcities" /> <datalist id="capitalcities"> <option value="Amsterdam"> <option value="Paris"> <option value="Canberra"> <option value="etc.."> </datalist> to get this happening from SMS: Either derive a descendent component from TW3Editbox with these behaviours or do this (not the most elegant coding maybe, but does do the job) : var MyEditBox := TW3EditBox.Create(self); MyEditBox.SetBounds(50,50,300,40); MyEditBox.handle.setAttribute('list','mycities'); var mydatalist := w3_createHtmlElement('DATALIST'); mydatalist.handle := MyEditBox.handle.parentNode.appendChild(mydatalist); mydatalist.handle.setAttribute('id','mycities'); mydatalist.innerHTML := #' <option value="Amsterdam"> <option value="Paris"> <option value="Canberra"> <option value="etc..">'; This doesn't work in the embedded browser in the ide However when executing from your index.html it works as expected, at least on desktop Edge/Chrome/Firefox. Didn't test this on desktop Safari or on mobile browsers
  5. array hooks

    Thanks for that. I usually set 'Make Project Internal', even for new projects. Just a habit really
  6. array hooks

    There is an annoying SMS bug when reloading project source which contains "]]" strings like in "edges[Vertices[i]].length" after reloading, all "]]" in the source code have been replaced by spaces : now reads like "edges[Vertices[i .length" workaround is to add a space myself : edges[Vertices[i] ].length Note: even submitting this post has its problems, the double "]" tokens get garbled after posting, only works after formatting as code
  7. universal data access components

    I've used Devarts universal data access components in Delphi, these work fantastic From their website : Any chance of persuading them to add SMS to the list ?
  8. Examples needed

    Couple of years ago I made up some Material Design components Demo's and source code on the link above. Note these are made with an older version of Smart, they will need some (minor) code revisions for latest beta
  9. architecture

    For interested parties, find below paired down version of the latest (and for me final) MVC demo / framework. I've made it as lean as possible. Demo here and project code here Based on a suggestion (IELite), the M, V and C components each live in their own project. They are bound together by combining the three compiled js files in the main html file : <body> <script type="text/javascript" src="view.js"></script> <script type="text/javascript" src="controller.js"></script> <script type="text/javascript" src="model.js"></script> </body> and setting the relative output path in the linker options to a shared parent directory ('..\')
  10. text-decoration is not working ?

    see if you can see which classes are actually active (DevTools). In the tryout below I manually edited the div of the first line with a line-through decoration Which works. Your css has to target the appropriate class
  11. text-decoration is not working ?

    don't know your projects content / css context, but if all else fails this will probably work <component>.handle.style.textDecoration := 'line-through';
  12. Tabbing through a form- TABSTOP Equivalent?

    you can set tabindex yourself (https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex) as in <component>.handle.tabindex = 14 or w3_setAttrib(Handle,'tabindex',14); The rtl sets tabindex standard to zero when cfKeyCapture is on. Not sure why that is edited : apparently 0 means that the element "should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention"
  13. LocalStorage on Android?

    have a look at Primoz AsmartBook . There is a section in there where he tests which functions are called at shutdown on which platforms. Maybe use the onBeforeUnload event ? Might help.
  14. architecture

    If someone is interested, some documentation here.
  15. architecture

    I must admit I'm getting a bit more comfortable with the MVC application architecture. The pro's are that applications are more structured, it does confine coding to distinctly separate areas and it forces a degree of analysis beforehand. The con's that there is generally more effort involved and that there are limitations in the choice of communication 'protocols' between the MVC components. There is a framework in the making which codifies application tasks into a generic structure uses this structure to generate the messaging scaffolding allows binding patterns as in V-C-M-C-V (view to controller to model to controller to view), V-M-V (direct bi-directional binding from visual elements to data), V-V (binding separate visual components on the same view/form), V-C-M-V and any other combination imaginable The demo here doesn't amount to much, just a form where new members can be added to a fictitious team. However demo was produced using this framework, features multiple application tasks, includes data-validation outside the view, uses various mvc-patterns, has a back-end datastore -- and comes in at a mere 14kB compiled
×