static int dm_placeModuleUnderAIBar_expiry = 4000; svoid dm_placeModuleUnderAIBar(O moduleOrID, fS query) { fO module = dm_getModule(moduleOrID); fS moduleID = dm_moduleID(moduleOrID); dm_showModule_noFocus(module); swing { JTextComponent aiBar = cast getCreatorOpt('tfTopInput); Rect mr = dm_getBounds(module); if (aiBar != null && mr != null) { Rectangle r = getBounds(aiBar); // height / query / timestamp T3 p = optCast(T3, quickImport(dm_generalMap_get('modulesUnderAIBar_y))); bool first = !(p != null && eq(p.b, query) && sysNow() <= p.c+dm_placeModuleUnderAIBar_expiry); int y = first ? 0 : p.a; // place on top if there is space (doesn't work like this) //if (y >= mr.h) y = 0; if (first) dm_generalMap_put('modulesUnderAIBar_firstModule, moduleID); //print("dm_place: " + p + " / " + y); dm_setBounds(module, r.x, y, r.width, mr.h); int yOut = y+mr.h; if (!first && p != null) yOut = max(yOut, p.a); dm_generalMap_put('modulesUnderAIBar_y, t3(yOut, query, y == 0 ? sysNow() : p.c)); } } }