Jump to content

tappatappa

uniGUI Subscriber
  • Posts

    333
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by tappatappa

  1. 2) I define "Images" property on TUniDBLookupComboBox ... hut how can I add image on the list ? I can not display an image in the list.

     

    I tried do put <img src='path/to/img.png'/> before each element, and only got partial results: the elements in the list got the correct images but the selected one appears with the html text

    post-1311-0-93459800-1525701068_thumb.png

  2. I got

    O553.setEmptyText is not a function
    

    the other approarch you suggest seems to work, thanks!

     

    Edit: here is the code that I am using right now

    if(!_empty_txt_set)
    {
       UniSession()->AddJS(UnicodeString().sprintf(L"%s.view.emptyText='<div class=\"x-grid-empty\">NO RESULT</div>';%s.getView().refresh();", grid->JSName, grid->JSName);
       _empty_txt_set = true;
    }
    

    so it uses the same div class as a EmptyText.
    I had to use a boolean because the Server side uniDBGrid still has an empty EmptyText.

  3. Hi,

    I am trying to set a DBGrid EmptyText at run time,

    if(MainDBGrid->EmptyText.IsEmpty())
    {
          MainDBGrid->EmptyText = "NO RECORD";
    }
    MainQuery->Open();
    

    but I get this Ajax error message

    O553.applyEmptyText is not a function
    

    I also tried to inject javascript directly, but the result is the same

    UniSession->AddJS(UnicodeString().sprintf(L"%s.emptyText = '%s'; %s.applyEmptyText();", MainDBGrid->JSName, UnicodeString(L"NO RECORD"), MainDBGrid->JSName);
    
  4. Hi Delphi Developer,

     

    Thanks for the link. I tried this

    TPngImage* p = new TPngImage();
    try
    {
        ImgList->GetPng(img_cache.index, p);
        p->Transparent = true;
        img->Picture->Graphic->Assign(p);
    }
    __finally
    {
        delete p;
    }
    

    And it kinda works. The only problem is that the pictures lose transparency, they get a black background.

    P.S. All the images I use are png

  5. Is it possible to "copy" an Image loaded in a TUniNativeImageList into a TUniImage?

    I tried several approaches, with no luck.

    img->Picture->Graphic->LoadFromStream(ImgList->Images[0]->MemoryImage);  //ACCESS VIOLATION
    

    Or

    TMemoryStream* s = new TMemoryStream();
    TNativeImageRecord* img_rec =  ImgList->Images[0];
    
    img_rec->MemoryImage->SaveToStream(s);  //ACCESS VIOLATION
    s->Position = 0;
    
    img->Picture->Graphic->LoadFromStream(s);
    

    Or

    TMemoryStream* s = new TMemoryStream();
    TNativeImageRecord* img_rec =  ImgList->Images[0];
    
    img_rec->Graphic->SaveToStream(s);  //ACCESS VIOLATION
    s->Position = 0;
    
    img->Picture->Graphic->LoadFromStream(s);
    

    Any help?

  6. //Delphi
    UniSession.AddJS(unicanvas.JSName + '._cc_.fillText("'+text+'",'+left+','+top+');');
    
    //C++
    UnicodeString s = UnicodeString().sprintf(L"%s._cc_.fillText('%s',%d,%d);", unicanvas->JSName, text, left, top);
    UniSession()->AddJS(s);
    

    Of course, is better if you do some escaping of the text first, otherwise you will be open to injection

  7. in the main cpp file (the one with the name of the project)

     

    
    #include <UniGUIVars.hpp>//<---------THIS
    #include <vcl.h>
    
    USEFORM("MainModule.cpp", UniMainModule); /* TUniGUIMainModule: File Type */
    USEFORM("ServerModule.cpp", UniServerModule); /* TUniGUIServerModule: File Type */
    USEFORM("Main.cpp", MainForm); /* TUniForm: File Type */
    //---------------------------------------------------------------------------
    #pragma link "UniGUIVars.obj" //<---------THIS
    #pragma TestProject
    
    //---------------------------------------------------------------------------
    WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    {
    
  8. 1) I am trying to use icons from here:

    https://material.io/icons/

     

    When clicking on the "Glyph" property in Delphi and then Clicking "Load" and selecting a PNG sourced from there, the image is loaded and displayed but when you then click OK, an error message "Invalid graphic format" is displayed with call stack as follows:

    http://i.imgur.com/wiOns0Z.png

     

    The same happens with a conventional VCL TSpeedButton so it looks like some kind of Delphi bug, but mentioning just in case this is something UniGUI can do something about.

     

     

    Glyph doesn't work with PNG with Alpha Channel (transparency)

  9. 2) Additionally I notice TUniSpeedButton has "Images" and "ImageIndex" properties.  I'd assumed that assigning a TUniImageList, populating it with PNG (which does work) and setting ImageIndex might cause the button to display the image but this appears to do nothing.   Can you clarify whether this is supposed to work or why these properties appear to be ignored?

     

    Thanks

     

    Walter

     

    It does work with TUniBitBtn, I use them a lot in my project. Do you need SpeedButton specifically?

  10. ok I figured it out, at first I thought you posted a piece of Delphi code.

    <a href="#" onclick="javascript:ajaxRequest(MainForm.window,'openClick');MainForm.window.showMask('wait');"style="text-decoration: none">
    

    thanks

  11.  

    Use this approach: 

    frmEmailSettings.grdEmails.showMask('Loading list...');
    

     

    Hi mohammad, let me give you a bit of context:

    I have a TUniDBText (TextConversion = txtHTML) with the underlying query something like

    select 
    '<table>'
         ||'<tr>'
              ||'<td colspan="2"><a href="#" onclick="javascript:ajaxRequest(MainForm.window,''openClick'');"style="text-decoration: none">'
                  ||'<div class="mydivclass">DETAILS</div>'
                  ||'</a></td>'
         ||'</tr>'
    ||'</table>'  a_html
    from mytable
    where a_id=1
    

    of course I am handling the event...

    void __fastcall TFormMain::UniFormAjaxEvent(TComponent *Sender, UnicodeString EventName, TUniStrings *Params)
    {
        if (EventName.Compare(L"openClick") == 0)
        {
            doSomething();
        }
    }
    

    But since the "click" event might take a while to process I need a way to tell the HTML/javascript side to show a mask covering the HTML table (or the form).

  12. +1

    As soon as I started using FieldLabel I noticed this inconsistency between design and runtime. This is pretty evident if set FieldAlign = alTop: nothing changes at design time, while at run time the Edit is moved several pixels down.

  13. In order to make it work you need to separate two steps:

    1) the Ext.override code and the beforeInit

    ....let the JS component render

     

    2) UniSession->AddJS(...)

     

    This is necessary because if you fire both at the same time (for instance at form first Show) the JS code can't find the ExtJS DatePicker.

     

    In practice, try to execute

     TMainForm.HighlightDatesPush(ADt: TDate; ATitle: string)
    

    after a Timer fires (once) or on button click

  14. Found a solution:

     

    1) Put this early in the application (for instance at the construction/show of the main form)

    
    Ext.override(Ext.DatePicker, {
            highlightDates:[],
            enablePickerHighlight:false,
            isAnotherMonthView: function(date) {
                var activeDate = this.activeDate || date; 
                return date.getYear() != activeDate.getYear() || date.getMonth() != activeDate.getMonth();
            },
    
            update: function(date, forceRefresh) {
                var me = this;
                monthViewChange = me.isAnotherMonthView(date);
    
                this.callParent(arguments);
    
                if(me.enablePickerHighlight){
                    me.highlightDates.forEach(function(dates) {
                        me.cells.each(function(el) {
                            if (Ext.Date.clearTime(dates.dt, true).valueOf() == el.dom.firstChild.dateValue) { 
                                if (el.hasCls(me.activeCls)) { 
                                    el.addCls('x-datepicker-highlight');
                                } else { 
                                    el.addCls('x-datepicker-highlight-prevnext'); 
                                }
                                //enable this if you wish custom title
                                /*el.dom.title = dates.title;*/
                                return false; 
                            };
                        });
                    });
        
                    if (monthViewChange) {
                         Ext.defer(function() {
                         me.fireEvent('select');
                         }, 200);
                    }
                }
            }
        });
    
    

    2) in the particular picker, beforeInit

    function picker.beforeInit(sender, config){
        config.highlightDates = [];
        config.enablePickerHighlight=true;
    }
    

    Thanks for your patience, I learned a lot, actually.

×
×
  • Create New...