Jump to content

andyhill

uniGUI Subscriber
  • Posts

    998
  • Joined

  • Last visited

  • Days Won

    3

andyhill last won the day on March 10

andyhill had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Melbourne Australia

Recent Profile Visitors

1979 profile views

andyhill's Achievements

Advanced Member

Advanced Member (4/4)

41

Reputation

  1. UniSession.AddJS( cbPurOwing checked = True or False )
  2. Thanks Sherzod for the Context Code. I have an issue with internal syncing of TUniCheckbox Tick with the browser - please show me how to set Checked with JavaScript instead. Here is my code:- procedure TfMain.cbPurOwingAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin ////////////////////////////////////////////////////////////////////////////// if EventName = '_RightClick_' then begin RightClickFlag:= True; ByPassChangeFlag:= True; if cbPurOwing.Checked = False then begin cbPurOwing.Checked:= True; // THIS HAS ISSUES SYNCRONIZING INTERNALLY WITH THE BROWSER ??? end else begin cbPurOwing.Checked:= False; // THIS HAS ISSUES SYNCRONIZING INTERNALLY WITH THE BROWSER ??? end; UniSession.AddJS('Ext.defer(function() {ajaxRequest(fMain.cbPurOwing, "_Process_", []);}, 1000)'); end; // '_RightClick_' ////////////////////////////////////////////////////////////////////////////// if EventName = '_Process_' then begin ByPassChangeFlag:= False; cbPurOwingChange(Self); end; end;
  3. Sherzod, the CSS above no longer works as intended ? Also I asked why I could not prevent Context Popup on Checkbox ?
  4. Sherzod, this was me testing:- CSS s:= '.customCheckboxGreen .x-form-checkbox '+ '{ '+ ' font-family: FontAwesome; '+ ' font-size: 16px; '+ ' background-image: none !important; '+ ' margin: 4px 0 0 0; '+ // Top, Right, Bottom, Left '} '+ '.customCheckboxGreen.x-form-cb-checked .x-form-checkbox:before '+ '{ '+ ' content: ''\f046''; '+ ' color: green; '+ '} '+ '.customCheckboxGreen .x-form-checkbox:before '+ '{ '+ ' content: ''\f096''; '+ '} '; CustomCSS.Add(s); // s:= '.customCheckboxRed .x-form-checkbox '+ '{ '+ ' font-family: FontAwesome; '+ ' font-size: 16px; '+ ' background-image: none !important; '+ ' margin: 4px 0 0 0; '+ // Top, Right, Bottom, Left '} '+ '.customCheckboxRed.x-form-cb-checked .x-form-checkbox:before '+ '{ '+ ' content: ''\f046''; '+ ' color: red; '+ '} '+ '.customCheckboxRed .x-form-checkbox:before '+ '{ '+ ' content: ''\f096''; '+ '} '; CustomCSS.Add(s); CHECKBOX cbPurOwing.LayoutConfig.BodyPadding:= '0 2 2 2'; // Top, Right, Bottom, Left *** NEVER UPDATES, MUST BE SET IN IDE *** with cbPurOwing.JSInterface do begin JSConfig('cls', ['customCheckboxGreen']); end; cbPurOwing.ClientEvents.ExtEvents.Clear; s:= 'mousedown=function mousedown(sender, x, y, eOpts) '#13#10 + '{ '#13#10 + // sender.preventDefault(); ' preventDefault(); '#13#10 + ' ajaxRequest(this, ''_eOpts_'', [''eOpts=''+eOpts]); '#13#10 + // eOpts=MouseButton: 0=Left, 2=Right '} '; cbPurOwing.ClientEvents.ExtEvents.Add(s); AJAXEVENT if EventName = '_eOpts_' then begin s:= Params['eOpts'].AsString; // MouseButton: 0=Left, 2=Right b:= StrToIntDef(s, 0); if b = 2 then begin // removeCls, addCls (setCls) configs with cbPurOwing do begin JSInterface.JSCall('removeCls', ['customCheckboxGreen']); JSInterface.JSCall('addCls', ['customCheckboxRed']); end; end else begin with cbPurOwing do begin JSInterface.JSCall('removeCls', ['customCheckboxRed']); JSInterface.JSCall('addCls', ['customCheckboxGreen']); end; end; end; // '_eOpts_' PROCESS LeftClick = Green RightClick THROWS UP CONTEXT MENU (I set disable above) ??? Please advise - thanks - Andy
  5. Yes, thank you Sherzod, colour is good - but how do I change this colour at runtime due to some internal status ? eg. if FaultyFlag = True then begin TickColor = Red end else begin TickColor = Green end;
  6. Perhaps I should have said not a static CSS rule, I need an individual approach that will not effect any other checkbox
  7. I have a need to use the colour of the CheckBox tick to indicate a particular status where one can change its colour at runtime (not CSS) - please advise - thanks.
  8. I need key press not key down. procedure TfMain.dbGridPurchasesKeyPress(Sender: TObject; var Key: Char); NEVER FIRES ?
  9. Sherzod, do you understand from my code above ? The Grid is not in edit mode, user scrolls Grid Rows, user presses SPACE bar on a desired Row, I capture the Key Event and test for SPACE Key - if pressed I then flip the Table Row Field TAG to True or False accordingly. Please advise
  10. dbGridPurchases.ClientEvents.ExtEvents.Clear; s:= 'keypress=function keypress(e, t, eOpts)'#13#10 + '{ '#13#10 + ' ajaxRequest(sender, '#39'_KeyPressed_'#39', ["key="+e.getKey()]); '#13#10 + '} '; dbGridPurchases.ClientEvents.ExtEvents.Add(s); ... ////////////////////////////////////////////////////////////////////////////// procedure TfMain.dbGridPurchasesAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); ... if EventName = '_KeyPressed_' then begin if Params.Values['key'] = ' ' then begin ReadOnly:= False; if UniMainModule.tblPurchases.ReadOnly = True then begin ReadOnly:= True; UniMainModule.tblPurchases.ReadOnly:= False; end; if UniMainModule.dsPurchases.DataSet.State in [dsInsert, dsEdit] then begin // DB // do nothing end else begin UniMainModule.tblPurchases.Edit; end; if UniMainModule.tblPurchases.FieldByName('Tag').AsBoolean = True then begin UniMainModule.tblPurchases.FieldByName('Tag').AsBoolean:= False; end else begin UniMainModule.tblPurchases.FieldByName('Tag').AsBoolean:= True; end; UniMainModule.tblPurchases.Post; if ReadOnly = True then begin UniMainModule.tblPurchases.ReadOnly:= True; end; end; end;
  11. Grid Active and not in edit mode, need to flip Tag field for focused ROW with SpaceBar via event
  12. I suppose different solutions are possible (including monitoring Form KeyPress) BUT after seeing procedure dbGridInvoicesKeyPress(Sender: TObject; var Key: Char); not work I then tried the JS way as shown above which also does not work ? I assume I have done something wrong ? I would like to do this the JS way if you would be so kind and show me how please - thanks Sherzod.
×
×
  • Create New...