Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] SuggestionEditor- cannot stop editing with Enter #250

Open
hyyan opened this issue Nov 8, 2022 · 0 comments
Open

[Bug] SuggestionEditor- cannot stop editing with Enter #250

hyyan opened this issue Nov 8, 2022 · 0 comments
Assignees
Labels
Change: Expert Needs specialized, in-depth review Priority: Medium The issue will be seen by about half of users. Status: Confirmed The issue is a bug and has been confirmed and an action will be taken Type: Bug The issue documents broken, incorrect, or confusing behavior.

Comments

@hyyan
Copy link
Member

hyyan commented Nov 8, 2022

By Rick van Baalen

After searching for a title and picking a title from the SuggestionEditor dropdown, you can’t press enter to stop the Full Row Editing. The only way to leave this column is with TAB or click in a different column.

Sample Program

use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
use ::BBjGridExWidget/GxCellEditors.bbj::GxCellEditorSuggestionResolver
use ::BBjGridExWidget/GxCellEditors.bbj::GxCellEditorSuggestion
use com.basiscomponents.db.ResultSet
use com.basiscomponents.bc.SqlQueryBC
use java.util.UUID

class public CustomResolver extends GxCellEditorSuggestionResolver
    
    method public void doResolve(BBjString term!)
      declare SqlQueryBC sbc!
      declare ResultSet rs!
      query! = ""
      query! = query! + "    SELECT"
      query! = query! + "        TITLE,"
      query! = query! + "        MUSICTYPE "
      query! = query! + "    FROM"
      query! = query! + "        CDINVENTORY "
      query! = query! + "    WHERE"
      query! = query! + "        CVS(TITLE,8) LIKE CVS('%s%%',8) "
      query! = query! + "    ORDER BY"
      query! = query! + "        MUSICTYPE"
      
      sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore"))
      
      rs! = sbc!.retrieve(String.format(query!, term!))
      if(rs! <> null() and rs!.count() > 0)
        it! = rs!.iterator()
        while it!.hasNext()
            next! = it!.next()
            label! = String.format("%s", next!.getFieldAsString("TITLE"))
            value! = next!.getFieldAsString("TITLE")

            rem add suggestion
            #addItem(label!, value!)
        wend
      fi
    methodend
    
classend

wnd! = BBjAPI().openSysGui("X0").addWindow(20, 20, 1000, 600, "SuggestionEditor")
wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye")
wnd!.setCallback(BBjAPI.ON_RESIZE,"resize")

gosub main

process_events

main:
    declare SqlQueryBC sbc!
    declare ResultSet rs!
    declare BBjGridExWidget grid!
    
    sbc! = new SqlQueryBC(BBjAPI().getJDBCConnection("CDStore"))
    rs! = sbc!.retrieve("SELECT TOP 10 CDNUMBER, TITLE, PLAYINGTIME, PLAYINGTIME as PLAYINGTIMEINHOURS, ARTIST FROM CDINVENTORY")
    
    grid! = new BBjGridExWidget(wnd!, 100, 0, 0, 1000, 600)
    grid!.getOptions().setEditable(1)
    grid!.getOptions().setEditType(grid!.GRID_EDITTYPE_ROW())
    grid!.setFitToGrid()
    
    grid!.addColumn("CDNUMBER", "CDNUMBER")
    grid!.addColumn("TITLE", "TITLE")
    grid!.addColumn("PLAYINGTIMEINHOURS", "Time in hours")
    
    column! = grid!.addColumn("PLAYINGTIME", "Time in minutes")
    exp! = "data.PLAYINGTIME = newValue; data.PLAYINGTIMEINHOURS = (newValue / 60).toFixed(2); return true;"
    column!.setValueSetterExpression(exp!)
    
    grid!.addColumn("ARTIST", "ARTIST")
    
    grid!.setData(rs!)
    
    editor! = new GxCellEditorSuggestion(UUID.randomUUID().toString(), new CustomResolver())
    editor!.setEmptyMessage("No data to display")
    editor!.setMinLength(1)
    editor!.setShowOnFocus(1)
    editor!.setWidth(300)
    
    column! = grid!.getColumn("TITLE")
    column!.setCellEditor(editor!)
return

resize:
    ev! = BBjAPI().getLastEvent()
    w = ev!.getWidth()
    h = ev!.getHeight()
    grid!.setSize(w,h)
return

byebye:
    bye
@hyyan hyyan self-assigned this Nov 8, 2022
@hyyan hyyan added Type: Bug The issue documents broken, incorrect, or confusing behavior. Priority: Medium The issue will be seen by about half of users. Status: Confirmed The issue is a bug and has been confirmed and an action will be taken Change: Expert Needs specialized, in-depth review labels Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change: Expert Needs specialized, in-depth review Priority: Medium The issue will be seen by about half of users. Status: Confirmed The issue is a bug and has been confirmed and an action will be taken Type: Bug The issue documents broken, incorrect, or confusing behavior.
Projects
None yet
Development

No branches or pull requests

1 participant